http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60603
Bug ID: 60603 Summary: .debug_macinfo has wrong line numbers for built-in macros Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: tromey at gcc dot gnu.org The DWARF standard says that macros coming from the command-line should have line number 0 in the .debug_macinfo data. I think this ought to apply to built-in macros as well. Right now gcc gets this wrong and uses a line number of 1. Here's a test program: barimba. cat c.c #define MACRO int q; Compile like: barimba. gcc -DCMDLINE -gstrict-dwarf -g3 -c c.c Now examine the output: Contents of the .debug_macinfo section: DW_MACINFO_define - lineno : 1 macro : __STDC__ 1 ... DW_MACINFO_define - lineno : 0 macro : CMDLINE 1 DW_MACINFO_start_file - lineno: 0 filenum: 1 DW_MACINFO_start_file - lineno: 0 filenum: 2 DW_MACINFO_define - lineno : 19 macro : _STDC_PREDEF_H 1 DW_MACINFO_define - lineno : 30 macro : __STDC_IEC_559__ 1 DW_MACINFO_define - lineno : 31 macro : __STDC_IEC_559_COMPLEX__ 1 DW_MACINFO_define - lineno : 35 macro : __STDC_ISO_10646__ 201103L DW_MACINFO_define - lineno : 38 macro : __STDC_NO_THREADS__ 1 DW_MACINFO_end_file DW_MACINFO_define - lineno : 1 macro : MACRO ... so, gcc gets CMDLINE correct but many other things (IMO) wrong.