Hi,
Current git master has the following aliasing issue with gcc 4.4:
gcc -D_GNU_SOURCE -DHAVE_CONFIG_H -DIS_LIBDW -I. -I.. -I. -I. -I./../libelf -I.. -I./../lib -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99 -g -O2 -MT dwarf_getaranges.o -MD -MP -MF .deps/dwarf_getaranges.Tpo -c -o dwarf_getaranges.o dwarf_getaranges.c cc1: warnings being treated as errors dwarf_getaranges.c: In function ‘dwarf_getaranges’: libdwP.h:540: error: dereferencing pointer ‘readp.44’ does break strict-aliasing rules dwarf_getaranges.c:152: note: initialized from here libdwP.h:519: error: dereferencing pointer ‘readp.44’ does break strict-aliasing rules dwarf_getaranges.c:174: note: initialized from here
I think the fix (attached) is to not threat readp as a const char, but as unsigned char in this function since __libdw_read_offset_inc function needs a non-const char**.
Or maybe the signature of the __libdw_read_offset_inc is wrong? I couldn't directly tell since the function uses some macros which uses some functions that actually seem to ignores all its arguments at the moment
Cheers,
Mark
libdwP.h:540: error: dereferencing pointer ?readp.44? does break strict-aliasing rules dwarf_getaranges.c:152: note: initialized from here libdwP.h:519: error: dereferencing pointer ?readp.44? does break strict-aliasing rules dwarf_getaranges.c:174: note: initialized from here
Please file a gcc bug about this internal name (".44") appearing in the error message. It should show the source-level construct.
Current git master has the following aliasing issue with gcc 4.4:
Thanks for noticing. I switched to F-11 and thus gcc-4.4 a few days ago, but my elfutils build had CFLAGS=-g (no -O2) and didn't produce these warnings.
I did some constification to clean things up.
Thanks, Roland
On Thu, 2009-06-18 at 13:56 -0700, Roland McGrath wrote:
libdwP.h:540: error: dereferencing pointer ?readp.44? does break strict-aliasing rules dwarf_getaranges.c:152: note: initialized from here libdwP.h:519: error: dereferencing pointer ?readp.44? does break strict-aliasing rules dwarf_getaranges.c:174: note: initialized from here
Please file a gcc bug about this internal name (".44") appearing in the error message. It should show the source-level construct.
Sorry, it seems to escape whenever I try to simplify the example, it must be some combination of the inlines, macro defines and casts. But except for the full original source I have been unable to replicate it in a anything smaller that could be used for a bug report.
Current git master has the following aliasing issue with gcc 4.4:
Thanks for noticing. I switched to F-11 and thus gcc-4.4 a few days ago, but my elfutils build had CFLAGS=-g (no -O2) and didn't produce these warnings.
I did some constification to clean things up.
Thanks. That makes more sense than my local "cleanup".
Cheers,
Mark
Sorry, it seems to escape whenever I try to simplify the example, it must be some combination of the inlines, macro defines and casts. But except for the full original source I have been unable to replicate it in a anything smaller that could be used for a bug report.
When nothing else can be found, the whole preprocessed source (.i file from -save-temps) is OK for a gcc bug report.
Thanks, Roland
On Fri, 2009-06-19 at 04:47 -0700, Roland McGrath wrote:
Sorry, it seems to escape whenever I try to simplify the example, it must be some combination of the inlines, macro defines and casts. But except for the full original source I have been unable to replicate it in a anything smaller that could be used for a bug report.
When nothing else can be found, the whole preprocessed source (.i file from -save-temps) is OK for a gcc bug report.
Done as follows: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40517
Thanks,
Mark
elfutils-devel@lists.fedorahosted.org