Test program: struct foo { int i; }; int bar (void) { return ((struct foo *)0x1234)->i; } Compile with -g; readelf does NOT show a definition of "struct foo" in the debug data. If I compile with -fno-eliminate-unused-debug-types, the definition does appear, but in the example program, foo isn't "unused".
Confirmed, a regression from 3.3.3.
Moving to 4.0.2 pre Mark.
Leaving as P2; we really ought to fix this.
I'll take a look at this.
This issue will not be resolved in GCC 4.1.0; retargeted at GCC 4.1.1.
Patch that fixes the problem. http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00380.html
Did I mention this fails on powerpc-darwin?
(In reply to comment #7) > Did I mention this fails on powerpc-darwin? > How so? pantani:/build/trunk/clean/gcc$ ./cc1 -quiet -g a.c -gstabs pantani:/build/trunk/clean/gcc$ grep foo a.s .stabs "foo:T(0,19)=s4i:(0,1),0,32;;",128,0,0,0 pantani:/build/trunk/clean/gcc$ ./cc1 -quiet -g a.c -gdwarf-2 pantani:/build/trunk/clean/gcc$ grep foo a.s .ascii "foo\0" pantani:/build/trunk/clean/gcc$ ./cc1 -quiet -g a.c -g3 pantani:/build/trunk/clean/gcc$ grep foo a.s .stabs "foo:T(0,19)=s4i:(0,1),0,32;;",128,0,0,0
(In reply to comment #8) > (In reply to comment #7) > > Did I mention this fails on powerpc-darwin? > > > > How so? darwin enables -feliminate-unused-debug-symbols by default.
> darwin enables -feliminate-unused-debug-symbols by default. You mean darwin does NOT enable the option by default, right?
(In reply to comment #10) > > darwin enables -feliminate-unused-debug-symbols by default. > > You mean darwin does NOT enable the option by default, right? No, there are two different options, and the other one is the stabs version and not the dwarf2 version.
> No, there are two different options, and the other one is the stabs version > and not the dwarf2 version. I'm confused. What options do you feed to the compiler that exhibit the bug, so I can look into it?
(In reply to comment #12) > I'm confused. What options do you feed to the compiler that exhibit the bug, > so I can look into it? -gstabs+ -feliminate-unused-debug-symbols (Note the symbols vs types in the option name).
> -gstabs+ -feliminate-unused-debug-symbols This is a different option than -feliminate-unused-debug-types, so I don't see how this applies. The patch I wrote was for eliminate-unused-debug-TYPES. I suppose if the darwin folks (or anyone else) want the code to apply to eliminate-unused-debug-SYMBOLS as well, they could submit a trivial patch.
(In reply to comment #14) > > -gstabs+ -feliminate-unused-debug-symbols > > This is a different option than -feliminate-unused-debug-types, so I don't see > how this applies. Because the tests fail by default on a secondary target (I am filing a new bug anyways).
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
This was fixed on the mainline.
*** Bug 28099 has been marked as a duplicate of this bug. ***
Closing 4.1 branch.