NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

What is the suggested way to use a C compiler with sanitizers?



Hello,

if one wants to use the sanitizer features of the C compiler, what is the suggested way?

If I e.g. compile and link with options

-O2  -g -O0 -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wall -Wextra -Wsign-compare -Wcast-align -Wcast-qual -Wmissing-prototypes -Wunused-parameter -Wunused-function -Wshadow -fno-common -fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow

(-O2 is from CFLAGS which should be reset by -O0)

I get something like

ui.c:2017:11: runtime error: member access within misaligned address 0xbebebebebebebebe for type 'struct filediff', which requires 8 byte alignment
0xbebebebebebebebe: note: pointer points here                                                    test 
<memory cannot be printed>                                                                      
ASAN:SIGSEGV                                                                                    
=================================================================                               
==1372==ERROR: AddressSanitizer: SEGV on unknown address 0x72d42a8a5000 (pc 0x0000004229c5 bp 0x7f7fff49c710 sp 0x7f7fff49c460 T0)
    #0 0x4229c4  (<unknown module>)                                                             
    #1 0x421dd7  (<unknown module>)                                                             
    #2 0x44b9be  (<unknown module>)                                                             
    #3 0x42a329  (<unknown module>)                                                             
    #4 0x4488ad  (<unknown module>)                                                             
    #5 0x413a90  (<unknown module>)                                                             
    #6 0x410e02  (<unknown module>)                                                             
    #7 0x4054ae  (<unknown module>)                                                             
    #8 0x4044ba  (<unknown module>)                                                             
                                                                                                
AddressSanitizer can not provide additional info.                                               
SUMMARY: AddressSanitizer: SEGV ??:0 ??                                                         
==1372==ABORTING

on errors.  What needs to be configured to make the symbolizer work?  (Binary is not stripped.)

Carsten


Home | Main Index | Thread Index | Old Index