[Bug debug/42065] DWARF .debug_macinfo contains unused macros

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 7 16:59:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42065

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-02-07
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
It doesn't look like this has changed between GCC 4.5 and GCC 7 so I'll confirm
it as a missing space optimization.

$ cat t.c && gcc -g3 -Wall -feliminate-unused-debug-symbols
-feliminate-unused-debug-types t.c && readelf -wm a.out | grep -e NOT -e USED
#define NOT used
#define USED(x) x
int main (void) { return USED (0); }
 DW_MACRO_GNU_define_indirect - lineno : 1 macro : NOT used
 DW_MACRO_GNU_define_indirect - lineno : 2 macro : USED(x) x

With GCC 7, even an empty object file contains 345 macro definitions (one for
each macro predefined by GCC):

$ /build/gcc-trunk/gcc/xgcc -B /build/gcc-trunk/gcc -c -g3 -xc -ot.o -
</dev/null && readelf -wm t.o | grep macro | wc -l
345


More information about the Gcc-bugs mailing list