http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48232
Summary: Excessive DW_AT_low_pc+DW_AT_high_pc for no code Product: gcc Version: 4.5.3 Status: UNCONFIRMED Severity: minor Priority: P3 Component: debug AssignedTo: unassig...@gcc.gnu.org ReportedBy: jan.kratoch...@redhat.com It affects any tested gcc: gcc (GCC) 4.4.6 20110322 (prerelease) gcc (GCC) 4.5.3 20110322 (prerelease) gcc (GCC) 4.6.0 20110322 (prerelease) gcc (GCC) 4.7.0 20110322 (experimental) echo 'int i;'|gcc -x c - -c -o 1.o -g;echo 'main(){}'|gcc -o 1 1.o -x c - <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit) <15> DW_AT_low_pc : 0x400474 <1d> DW_AT_high_pc : 0x400474 DWARF-4: # Compilation unit entries may have the following attributes: # 1. Either a DW_AT_low_pc and DW_AT_high_pc pair of attributes # or a DW_AT_ranges attribute whose values encode the contiguous # or non-contiguous address ranges, respectively, of the machine instructions # generated for the compilation unit (see Section 2.17). Also according to my mail http://sourceware.org/ml/gdb-patches/2011-03/msg00739.html DWARF-4 does not say explicitly what does mean DW_AT_low_pc == DW_AT_high_pc but for DW_AT_ranges it says A range list entry (but not a base address selection or end of list entry) whose beginning and ending addresses are equal has no effect because the size of the range covered by such an entry is zero. therefore I believe DW_AT_low_pc == DW_AT_high_pc means such DIE should be ignored and such DIE is IMO invalid. elfutils dwarflint complains now (upon my request) on DW_AT_low_pc==DW_AT_high_pc, with Jakub Jelinek's reaction: # warnings about low_pc not below high_pc (e.g. for CUs which generated no # code, but only some vars), I believe neither DW_AT_low_pc nor DW_AT_high_pc should be produced in such cases. If it is not agreed upon it may be worth bringing it up on dwarf-discuss.