https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107909
Bug ID: 107909 Summary: [powerpc64le, debug] Incorrect call site location due to nop after call insn Product: gcc Version: 7.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org Target Milestone: --- Consider test-case vla-optimized-out.c: ... int __attribute__((noinline,weak)) __attribute__((noclone)) f1 (int i) { char a[i + 1]; a[0] = 5; return a[0]; } int main (void) { volatile int j; int i = 5; asm volatile ("" : "=r" (i) : "0" (i)); j = f1 (i); return 0; } ... compiled with -O1 -g. We generate a nop after the bl insn: ... bl f1 # 11 *call_value_nonlocal_aixdi [length = 8] nop .LVL4: ... and the label after the nop is a call site location: ... .uleb128 0x5 # (DIE (0x67) DW_TAG_GNU_call_site) .8byte .LVL4 # DW_AT_low_pc .4byte 0x81 # DW_AT_abstract_origin ... Consequently we can't actually find the call site: ... $ gdb -q -batch ./a.out -ex "break f1" -ex run -ex "set debug entry-values 1" -ex "print sizeof (a)" Breakpoint 1 at 0x1000065c: file vla-optimized-out.c, line 8. Breakpoint 1, f1 (i=5) at vla-optimized-out.c:8 8 } DW_OP_entry_value resolving cannot find DW_TAG_call_site 0x10000690 in main $1 = <optimized out> ... If we manually fix this in the .s file, we get a bit further: ... $ gdb -q -batch ./a.out -ex "break f1" -ex run -ex "set debug entry-values 1" -ex "print sizeof (a)" Breakpoint 1 at 0x1000065c: file vla-optimized-out.c, line 8. Breakpoint 1, f1 (i=5) at vla-optimized-out.c:8 8 } Cannot find matching parameter at DW_TAG_call_site 0x10000690 at main $1 = <optimized out> ... The problem now is that the DW_AT_abstract_origin in the DW_TAG_GNU_call_site is not properly handled by gdb. I reproduced this with gcc 7.5.0, but after looking at the pattern for call_value_nonlocal_aixdi I think this should be reproducible with trunk.