https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91968
Bug ID: 91968 Summary: DW_AT_low_pc missing for DW_TAG_label with LTO Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: keiths at redhat dot com Target Milestone: --- Compilers tested: gcc version 10.0.0 20190930, several Fedora system compilers, e.g., Fedora 29 (gcc version 9.2.1 20190827 (Red Hat 9.2.1-1). Consider the simple program (from GDB's test suite, gdb/testsuite/gdb.base/label.c): #include <stdio.h> int main (int argc, char **argv) { int i = 0; goto there; here: printf("not here\n"); i = 1; there: printf("but here\n"); if (i == 0) goto here; done: return 0; } If this is compiled with LTO (gcc -g -flto label.c)[1], GDB is unable to set a breakpoint at any of the labels. This is because GDB is looking for DW_AT_low_pc, but this attribute is missing from the DIEs for the labels: <2><f7>: Abbrev Number: 8 (DW_TAG_label) <f8> DW_AT_name : (indirect string, offset: 0xfe): there <fc> DW_AT_decl_file : 1 <fd> DW_AT_decl_line : 13 <fe> DW_AT_decl_column : 1 <2><ff>: Abbrev Number: 8 (DW_TAG_label) <100> DW_AT_name : (indirect string, offset: 0xff): here <104> DW_AT_decl_file : 1 <105> DW_AT_decl_line : 9 <106> DW_AT_decl_column : 1 <2><107>: Abbrev Number: 8 (DW_TAG_label) <108> DW_AT_name : (indirect string, offset: 0xc6): done <10c> DW_AT_decl_file : 1 <10d> DW_AT_decl_line : 18 <10e> DW_AT_decl_column : 1 Is GDB supposed to deal with this in some other way? [1] Alternatively, if you have a GDB build lying around: $ make check RUNTESTFLAGS="--target_board unix/-flto" \ TESTS=gdb.base/label.exp That test will show several internal errors (assertion failures) as a result of this.