void bar (char *);
void baz (int);
char a[10];

void __attribute__((noinline))
bar (char *p)
{
  asm volatile ("" : : "r" (p) : "memory");
}

void __attribute__((noinline))
baz (int i)
{
  asm volatile ("" : : "r" (i) : "memory");
}

int __attribute__((noinline))
foo (int i)
{
  bar (a);
  baz (a[i + 1]);
  return i;
}

int
main (void)
{
  foo (7);
  return 0;
}
on x86_64-linux -O2 -g has wrong location info for i during epilogue - i is
said to live in %edi initially (correct), then in %ebx starting from middle of
the first call (also correct), but at the end of function it does:
        movl    %ebx, %eax
        popq    %rbx
and of course the restoring of %rbx invalidates the location (so var-tracking
should say that i now lives in %eax instead).


-- 
           Summary: var-tracking fails to notice a value change
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-debug
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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

Reply via email to