http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49906
Summary: wrong .debug_line for -O0 -g prologue skip Product: gcc Version: 4.4.7 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassig...@gcc.gnu.org ReportedBy: jan.kratoch...@redhat.com Target: x86_64-unknown-linux-gnu FAIL: gcc (GCC) 4.4.7 20110729 (prerelease) FAIL: gcc (GCC) 4.5.4 20110729 (prerelease) FAIL: gcc (GCC) 4.6.2 20110729 (prerelease) FAIL: gcc (GCC) 4.7.0 20110728 (experimental) -g ------------------------------------------------------------------------------- static int i; static void f (void) { for (;;) if (i++) break; } int main (void) { f (); return 0; } ------------------------------------------------------------------------------- (gdb) break f Breakpoint 1 at 0x40045a: file src12932.c, line 8. (gdb) run Breakpoint 1, f () at src12932.c:8 8 } (gdb) print i Actual: $1 = 1 Expected: $1 = 0 ------------------------------------------------------------------------------- Original GDB bugreport: http://sourceware.org/bugzilla/show_bug.cgi?id=12932 ------------------------------------------------------------------------------- Line Number Statements: Extended opcode 2: set Address to 0x400454 Special opcode 8: advance Address by 0 to 0x400454 and Line by 3 to 4 Special opcode 93: advance Address by 6 to 0x40045a and Line by 4 to 8 Special opcode 17: advance Address by 1 to 0x40045b and Line by -2 to 6 ------------------------------------------------------------------------------- 0000000000400454 <f>: f(): /home/jkratoch/t/src12932.c:4 400454: 55 push %rbp 400455: 48 89 e5 mov %rsp,%rbp 400458: eb 01 jmp 40045b <f+0x7> /home/jkratoch/t/src12932.c:8 40045a: 90 nop /home/jkratoch/t/src12932.c:6 40045b: 8b 05 17 04 20 00 mov 0x200417(%rip),%eax # 600878 <i> 400461: 85 c0 test %eax,%eax 400463: 0f 95 c2 setne %dl 400466: 83 c0 01 add $0x1,%eax 400469: 89 05 09 04 20 00 mov %eax,0x200409(%rip) # 600878 <i> 40046f: 84 d2 test %dl,%dl 400471: 74 e7 je 40045a <f+0x6> /home/jkratoch/t/src12932.c:7 400473: 90 nop /home/jkratoch/t/src12932.c:8 400474: 5d pop %rbp 400475: c3 retq