Aliasing troubles in dwarf_getaranges with gcc 4.4
by Mark Wielaard
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
14 years, 11 months
reference tracker
by Roland McGrath
I've implemented the ref tracker and revamped dwarfcmp using it.
The roland/dwarf-refcmp temp branch is gone now
(I recommend "git remote prune origin").
I haven't done any real testing, just the make check self-comparison tests.
As always, more eyeballs on the code and feedback are most welcome.
Most of the work was in the comparator revamp to set everything up for the
ref tracker. If the ref tracker itself needs more work, it should not be
too much trouble. It all lacks lots of comments, sorry. I might get to it
soon. Or if you start asking about the code, I'll fill it in with comments
to clarify those answers.
Thanks,
Roland
14 years, 11 months