diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-04-06 13:49:59 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-04-06 13:49:59 +0200 |
commit | fe84628425a9b784688e5e7fbbd081acd6261e90 (patch) | |
tree | 48e1b21d04a80c8e8bbbed2129f5f2722bd854bc /gcc | |
parent | acce4e77382b198a70f1044724bda19b01997657 (diff) | |
download | gcc-fe84628425a9b784688e5e7fbbd081acd6261e90.zip gcc-fe84628425a9b784688e5e7fbbd081acd6261e90.tar.gz gcc-fe84628425a9b784688e5e7fbbd081acd6261e90.tar.bz2 |
re PR debug/48466 (Wrong variable locations at -O0 on i686)
PR debug/48466
* dwarf2out.c (based_loc_descr): If drap_reg is INVALID_REGNUM, use
as base_reg whatever register reg has been eliminated to, instead
of hardcoding STACK_POINTER_REGNUM.
* gcc.dg/guality/pr36977.c: New test.
* gcc.dg/guality/pr48466.c: New test.
From-SVN: r172039
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/guality/pr36977.c | 32 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/guality/pr48466.c | 41 |
5 files changed, 87 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f413ed2..e593f56 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-04-06 Jakub Jelinek <jakub@redhat.com> + + PR debug/48466 + * dwarf2out.c (based_loc_descr): If drap_reg is INVALID_REGNUM, use + as base_reg whatever register reg has been eliminated to, instead + of hardcoding STACK_POINTER_REGNUM. + 2011-04-06 Joseph Myers <joseph@codesourcery.com> * doc/tm.texi.in: Document C target hooks as separate from general diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 847e8ef..753424a 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -13395,7 +13395,7 @@ based_loc_descr (rtx reg, HOST_WIDE_INT offset, int base_reg = DWARF_FRAME_REGNUM ((fde && fde->drap_reg != INVALID_REGNUM) ? HARD_FRAME_POINTER_REGNUM - : STACK_POINTER_REGNUM); + : REGNO (elim)); return new_reg_loc_descr (base_reg, offset); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a3c8dfd..caacb0c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-04-06 Jakub Jelinek <jakub@redhat.com> + + PR debug/48466 + * gcc.dg/guality/pr36977.c: New test. + * gcc.dg/guality/pr48466.c: New test. + 2011-04-06 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org> * gcc.target/arm/pr43920-1.c: Fix accidental duplication. diff --git a/gcc/testsuite/gcc.dg/guality/pr36977.c b/gcc/testsuite/gcc.dg/guality/pr36977.c new file mode 100644 index 0000000..3689fae --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/pr36977.c @@ -0,0 +1,32 @@ +/* PR debug/36977 */ +/* { dg-do run } */ +/* { dg-options "-g" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ + +void +foo () +{ +} + +int +main () +{ + struct { char c[100]; } cbig; + struct { int i[800]; } ibig; + struct { long l[900]; } lbig; + struct { float f[200]; } fbig; + struct { double d[300]; } dbig; + struct { short s[400]; } sbig; + + ibig.i[0] = 55; /* { dg-final { gdb-test 30 "ibig.i\[0\]" "55" } } */ + ibig.i[100] = 5; /* { dg-final { gdb-test 30 "ibig.i\[100\]" "5" } } */ + cbig.c[0] = '\0'; /* { dg-final { gdb-test 30 "cbig.c\[0\]" "'\\0'" } } */ + cbig.c[99] = 'A'; /* { dg-final { gdb-test 30 "cbig.c\[99\]" "'A'" } } */ + fbig.f[100] = 11.0; /* { dg-final { gdb-test 30 "fbig.f\[100\]" "11" } } */ + dbig.d[202] = 9.0; /* { dg-final { gdb-test 30 "dbig.d\[202\]" "9" } } */ + sbig.s[90] = 255; /* { dg-final { gdb-test 30 "sbig.s\[90\]" "255" } } */ + lbig.l[333] = 999; /* { dg-final { gdb-test 30 "lbig.l\[333\]" "999" } } */ + + foo (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/guality/pr48466.c b/gcc/testsuite/gcc.dg/guality/pr48466.c new file mode 100644 index 0000000..8d5426a --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/pr48466.c @@ -0,0 +1,41 @@ +/* PR debug/48466 */ +/* { dg-do run } */ +/* { dg-options "-g" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ + +struct S { unsigned int a; unsigned int *b; }; +struct T { struct S a; struct S b; }; +struct U { const char *u; }; +int n[10]; +volatile int v; + +struct U +foo (const char *s) +{ + struct U r; + r.u = s; + return r; +} + +void +bar (struct T *s, int a, int b) +{ + s->a.a = a; + s->a.b = &s->a.a; + s->b.a = b; + s->b.b = &s->b.a; +} + +int +main () +{ + struct T t; + struct U x = foo ("this is x"); + struct S y, z; + y.b = n; /* { dg-final { gdb-test 38 "t.a.a" "17" } } */ + y.a = 0; /* { dg-final { gdb-test 38 "*t.a.b" "17" } } */ + bar (&t, 17, 21); /* { dg-final { gdb-test 38 "t.b.a" "21" } } */ + v++; /* { dg-final { gdb-test 38 "*t.b.b" "21" } } */ + z = y; + return 0; +} |