[cfe-dev] Fwd: clang may generate incorrect dwarf info?

Andriy Gapon avg at FreeBSD.org
Wed Apr 3 08:25:38 PDT 2013


on 03/04/2013 18:17 Eric Christopher said the following:
> What's the actual definition look like?
> 
> ghostwheel:~/tmp> cat foo.c
> void _sx_xunlock(struct sx *sx, const char *file, int line) {}

A full preprocessed file along with .o can be found here:
http://people.freebsd.org/~avg/kern_sx.tgz

Command line options:
-pipe -fno-strict-aliasing -march=amdfam10 -std=c99 -g -O -Wall -Wredundant-decls
-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline
-Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs
-fdiagnostics-show-option -Wno-error-tautological-compare -Wno-error-empty-body
-Wno-error-parentheses-equality -nostdinc -fno-omit-frame-pointer
-mno-omit-leaf-frame-pointer -mno-aes -mno-avx -mcmodel=kernel -mno-red-zone
-mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding
-fstack-protector -Werror

clang is from FreeBSD tree:
FreeBSD clang version 3.2 (tags/RELEASE_32/final 170710) 20121221

> 0x00000026:     TAG_subprogram [2] *
>                  AT_name( "_sx_xunlock" )
>                  AT_decl_file( "/Users/echristo/tmp/foo.c" )
>                  AT_decl_line( 1 )
>                  AT_prototyped( 0x01 )
>                  AT_external( 0x01 )
>                  AT_low_pc( 0x0000000000000000 )
>                  AT_high_pc( 0x0000000000000011 )
>                  AT_frame_base( rbp )
> 
> 0x00000041:         TAG_formal_parameter [3]
>                      AT_name( "sx" )
>                      AT_decl_file( "/Users/echristo/tmp/foo.c" )
>                      AT_decl_line( 1 )
>                      AT_type( {0x00000072} ( sx* ) )
>                      AT_location( fbreg -8 )
> 
> 0x0000004f:         TAG_formal_parameter [3]
>                      AT_name( "file" )
>                      AT_decl_file( "/Users/echristo/tmp/foo.c" )
>                      AT_decl_line( 1 )
>                      AT_type( {0x00000083} ( const char* ) )
>                      AT_location( fbreg -16 )
> 
> 0x0000005d:         TAG_formal_parameter [3]
>                      AT_name( "line" )
>                      AT_decl_file( "/Users/echristo/tmp/foo.c" )
>                      AT_decl_line( 1 )
>                      AT_type( {0x00000088} ( int ) )
>                      AT_location( fbreg -20 )
> 
> 0x0000006b:         NULL
> 
> with current clang.

Thus far, I've spotted the problem _only_ with this particular function in this
particular source file.

Thank you.
-- 
Andriy Gapon



More information about the cfe-dev mailing list