[Bug debug/44205] New: Wrong .debug_line for -O0 -g

jan dot kratochvil at redhat dot com gcc-bugzilla@gcc.gnu.org
Wed May 19 22:49:00 GMT 2010


extern int i;
void
f (void)
{
  if (i)
    {
      if (i)
        i = 0;
      else
        i = 1;
    }
  else
    i = 2;
}

gcc -c -g
objdump -dS

        i = 0;
  18:   c7 05 00 00 00 00 00    movl   $0x0,0x0(%rip)        # 22 <f+0x22>
  1f:   00 00 00
      else
        i = 1;
  22:   eb 16                   jmp    3a <f+0x3a>
  24:   c7 05 00 00 00 00 01    movl   $0x1,0x0(%rip)        # 2e <f+0x2e>
  2b:   00 00 00
  2e:   eb 0a                   jmp    3a <f+0x3a>

jmp at offset 22 should belong to the "i = 0;" line.

Problem reproduced on:
gcc (GCC) 4.4.5 20100519 (prerelease)
gcc (GCC) 4.5.1 20100519 (prerelease)
gcc (GCC) 4.6.0 20100519 (experimental)
gcc-4.4.3-4.fc12.x86_64

Correct output on:
gcc-4.1.2-48.el5.x86_64

This will cause GDB to skip the line on `step' (which is a workaround in GDB
for missing is_stmt info).

Can GCC use its own new gdb guality framework to test it on its own?
There was before: PR debug/29609, PR debug/36690, PR debug/37616


-- 
           Summary: Wrong .debug_line for -O0 -g
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan dot kratochvil at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44205



More information about the Gcc-bugs mailing list