https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90717
Bug ID: 90717 Summary: wrong stmt location for breakpoint, XFAIL gcc.dg/guality/pr90716.c -flto -fuse-linker-plugin Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- The gcc.dg/guality/pr90716.c testcase fails with -O2 -fwhole-program, expanding from main () { <bb 2> [local count: 17041817]: [t.c:12:3] # DEBUG BEGIN_STMT [t.c:13:3] # DEBUG BEGIN_STMT [t.c:13:5] # DEBUG b => 0 [t.c:14:3] # DEBUG BEGIN_STMT # DEBUG b => 0 [t.c:14:10] # DEBUG BEGIN_STMT # DEBUG j => 0 [t.c:16:14] # DEBUG BEGIN_STMT ... unrolled loop ... [t.c:16:14] # DEBUG BEGIN_STMT [t.c:17:2] # DEBUG BEGIN_STMT [t.c:16:21] # DEBUG BEGIN_STMT # DEBUG j => 8 [t.c:16:14] # DEBUG BEGIN_STMT [t.c:14:17] # DEBUG BEGIN_STMT # DEBUG b => 7 [t.c:14:10] # DEBUG BEGIN_STMT [t.c:23:3] # DEBUG BEGIN_STMT [t.c:23:3] optimize_me_not (); [t.c:24:3] # DEBUG BEGIN_STMT return 0; gdb puts the breakpoint at Breakpoint 1, main () at /space/rguenther/src/svn/trunk2/gcc/testsuite/gcc.dg/guality/pr90716.c:23 23 optimize_me_not(); /* { dg-final { gdb-test . "j + 1" "9" } } */ (gdb) disassemble Dump of assembler code for function main: => 0x00000000004003e0 <+0>: xor %eax,%eax 0x00000000004003e2 <+2>: callq 0x4004d0 <optimize_me_not> 0x00000000004003e7 <+7>: xor %eax,%eax 0x00000000004003e9 <+9>: retq where (gdb) p j $1 = 0 but at the "correct" location the correct value is displayed. (gdb) si 0x00000000004003e2 23 optimize_me_not(); /* { dg-final { gdb-test . "j + 1" "9" } } */ (gdb) p j $2 = 8 Somehow things must go wrong on the RTL / debuginfo creation level putting the location views for 'j' on a assembler stmt associated with line 23.