https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90017
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-debug CC| |aoliva at gcc dot gnu.org, | |jakub at gcc dot gnu.org --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Hmm, I think the debuginfo is "correct", at the last invocation of optimize_me_not () l is indeed 8. At -O3 we "merely" unrolled the inner loop completely. When you step through the program at each optimize_me_not invoation the value of l is correct but gdb seems to set only one breakpoint for 'b 15' which you can see doing (gdb) b optimize_me_not (gdb) b 15 (gdb) run Breakpoint 1, optimize_me_not () at t.c:2 2 __asm__ volatile ("" : : : "memory"); (gdb) c Continuing. Breakpoint 1, optimize_me_not () at t.c:2 2 __asm__ volatile ("" : : : "memory"); (gdb) c Continuing. Breakpoint 1, optimize_me_not () at t.c:2 2 __asm__ volatile ("" : : : "memory"); (gdb) c Continuing. Breakpoint 1, optimize_me_not () at t.c:2 2 __asm__ volatile ("" : : : "memory"); (gdb) c Continuing. Breakpoint 2, main () at t.c:15 15 optimize_me_not(); looking at disassembly with source interleaved shows that this might get wrong somewhere during debug-info creation, not sure exactly how we compute the line number program. Maybe it's also a consumer issue.