/* { dg-do run } */ /* { dg-options "-O2 -march=i586 -dA -g -fomit-frame-pointer" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
void __attribute__((noinline)) bar (int *p) { (*p)++; asm volatile ("" : "=r" (*p) : "0" (*p) : "memory"); } void __attribute__((noinline)) baz (int a, int b, int c, int d, int e, int f) { asm volatile ("" : : "r" (a + b + c + d + e + f) : "memory"); } int __attribute__((noinline)) foo (int x) { int y; y = 5; bar (&y); baz (0, 1, 2, 3, 4, 5); bar (&x); y++; baz (1, 2, 3, 4, 5, 6); bar (&y); return x + y; } int main () { if (foo (17) != 8 + 18) __builtin_abort (); return 0; } has wrong debuginfo for variable y - (mem (sp + offset)) live across several sp adjustments. In the debugger inside foo when using nexti and printing y after each nexti, it first starts as <optimized out> (expected), then y = 5 is executed and it prints 5, but then sp is adjusted and it prints garbage because sp changed. I believe we should be de-eliminating stack_pointer_rtx resp. hard_frame_pointer_rtx based MEMs in var-tracking generated notes back to arg_pointer_rtx / frame_pointer_rtx based notes when they aren't meant to change whenever sp resp. fp changes. On the http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43051#c1 testcase this doesn't show up as wrong debug, but just inefficient location list (LVL1 through LVL2 the argument is fbreg 0, while from LVL2 to LVL12 it is breg5 8 when both locations are actually the same memory. There is also the additional problem that we leave out the epilogue ret insn, as if the parameter wasn't defined at that spot. -- Summary: [4.5 Regression] Wrong debuginfo with VTA and -fomit- frame-pointer/-mno-accumulate-outgoing-args 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 GCC target triplet: i686-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43092