public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/48466] [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686
  2011-04-05 18:13 [Bug debug/48466] New: [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686 jakub at gcc dot gnu.org
@ 2011-04-05 18:13 ` jakub at gcc dot gnu.org
  2011-04-05 18:55 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-05 18:13 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.4.6


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/48466] New: [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686
@ 2011-04-05 18:13 jakub at gcc dot gnu.org
  2011-04-05 18:13 ` [Bug debug/48466] " jakub at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-05 18:13 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [4.4/4.5/4.6 Regression] Wrong variable locations at
                    -O0 on i686
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org
                CC: tromey@gcc.gnu.org, hjl@gcc.gnu.org


struct S { int a; 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;
  y.a = 0;
  bar (&t, 1, 2);
  v++;
  z = y;
  return 0;
}

compiled with -g -O0 -dA, when you debug this in the debugger, &t is different
from the address passed to bar and after the bar call t contains garbage.
Most likely this started with
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138438
The t variable has DECL_RTL (mem (plus (frame) (const_int -16)), (frame) is
eliminated to bp - 4, but crtl->stack_realign_tried is true (eventhough
fde->stack_realign is false) and thus it is encoded as sp - 20 instead of bp -
20.  fde->drap_reg is -1.
http://gcc.gnu.org/ml/gcc-patches/2008-07/msg02391.html


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/48466] [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686
  2011-04-05 18:13 [Bug debug/48466] New: [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686 jakub at gcc dot gnu.org
  2011-04-05 18:13 ` [Bug debug/48466] " jakub at gcc dot gnu.org
@ 2011-04-05 18:55 ` jakub at gcc dot gnu.org
  2011-04-05 19:13 ` hjl.tools at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-05 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-05 18:55:37 UTC ---
Created attachment 23885
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23885
gcc46-pr48466.patch

This seems to work and doesn't regress PR36977 (which I've added as guality
testcase too).  Whether it is the right thing to do, I'm not 100% sure though.
H.J.?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/48466] [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686
  2011-04-05 18:13 [Bug debug/48466] New: [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686 jakub at gcc dot gnu.org
  2011-04-05 18:13 ` [Bug debug/48466] " jakub at gcc dot gnu.org
  2011-04-05 18:55 ` jakub at gcc dot gnu.org
@ 2011-04-05 19:13 ` hjl.tools at gmail dot com
  2011-04-06 11:50 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2011-04-05 19:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2011-04-05 19:12:53 UTC ---
(In reply to comment #1)
> Created attachment 23885 [details]
> gcc46-pr48466.patch
> 
> This seems to work and doesn't regress PR36977 (which I've added as guality
> testcase too).  Whether it is the right thing to do, I'm not 100% sure though.
> H.J.?

Looks good to me.  Thanks.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/48466] [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686
  2011-04-05 18:13 [Bug debug/48466] New: [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686 jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-04-05 19:13 ` hjl.tools at gmail dot com
@ 2011-04-06 11:50 ` jakub at gcc dot gnu.org
  2011-04-06 20:40 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-06 11:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-06 11:50:03 UTC ---
Author: jakub
Date: Wed Apr  6 11:49:59 2011
New Revision: 172039

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172039
Log:
    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.

Added:
    trunk/gcc/testsuite/gcc.dg/guality/pr36977.c
    trunk/gcc/testsuite/gcc.dg/guality/pr48466.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/48466] [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686
  2011-04-05 18:13 [Bug debug/48466] New: [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686 jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-04-06 11:50 ` jakub at gcc dot gnu.org
@ 2011-04-06 20:40 ` jakub at gcc dot gnu.org
  2011-04-06 20:42 ` [Bug debug/48466] [4.4/4.5 " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-06 20:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-06 20:40:28 UTC ---
Author: jakub
Date: Wed Apr  6 20:40:24 2011
New Revision: 172064

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172064
Log:
    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.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/guality/pr36977.c
    branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/guality/pr48466.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/dwarf2out.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/48466] [4.4/4.5 Regression] Wrong variable locations at -O0 on i686
  2011-04-05 18:13 [Bug debug/48466] New: [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686 jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-04-06 20:40 ` jakub at gcc dot gnu.org
@ 2011-04-06 20:42 ` jakub at gcc dot gnu.org
  2011-04-07 18:31 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-06 20:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.04.06 20:41:29
            Summary|[4.4/4.5/4.6 Regression]    |[4.4/4.5 Regression] Wrong
                   |Wrong variable locations at |variable locations at -O0
                   |-O0 on i686                 |on i686
     Ever Confirmed|0                           |1

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-06 20:41:29 UTC ---
Fixed for 4.6+ for now.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/48466] [4.4/4.5 Regression] Wrong variable locations at -O0 on i686
  2011-04-05 18:13 [Bug debug/48466] New: [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686 jakub at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-04-06 20:42 ` [Bug debug/48466] [4.4/4.5 " jakub at gcc dot gnu.org
@ 2011-04-07 18:31 ` jakub at gcc dot gnu.org
  2011-04-07 21:28 ` [Bug debug/48466] [4.4 " jakub at gcc dot gnu.org
  2011-04-07 22:21 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-07 18:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-07 18:30:39 UTC ---
Author: jakub
Date: Thu Apr  7 18:30:36 2011
New Revision: 172118

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172118
Log:
    Backported from mainline
    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.

    * gcc.dg/guality/pr36977.c: New test.
    * gcc.dg/guality/pr48466.c: New test.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/guality/pr36977.c
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/guality/pr48466.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/dwarf2out.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/48466] [4.4 Regression] Wrong variable locations at -O0 on i686
  2011-04-05 18:13 [Bug debug/48466] New: [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686 jakub at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2011-04-07 18:31 ` jakub at gcc dot gnu.org
@ 2011-04-07 21:28 ` jakub at gcc dot gnu.org
  2011-04-07 22:21 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-07 21:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-07 21:28:02 UTC ---
Author: jakub
Date: Thu Apr  7 21:27:59 2011
New Revision: 172133

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172133
Log:
    Backported from mainline
    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.

Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/dwarf2out.c


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/48466] [4.4 Regression] Wrong variable locations at -O0 on i686
  2011-04-05 18:13 [Bug debug/48466] New: [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686 jakub at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2011-04-07 21:28 ` [Bug debug/48466] [4.4 " jakub at gcc dot gnu.org
@ 2011-04-07 22:21 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-07 22:21 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-07 22:21:19 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-04-07 22:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-05 18:13 [Bug debug/48466] New: [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686 jakub at gcc dot gnu.org
2011-04-05 18:13 ` [Bug debug/48466] " jakub at gcc dot gnu.org
2011-04-05 18:55 ` jakub at gcc dot gnu.org
2011-04-05 19:13 ` hjl.tools at gmail dot com
2011-04-06 11:50 ` jakub at gcc dot gnu.org
2011-04-06 20:40 ` jakub at gcc dot gnu.org
2011-04-06 20:42 ` [Bug debug/48466] [4.4/4.5 " jakub at gcc dot gnu.org
2011-04-07 18:31 ` jakub at gcc dot gnu.org
2011-04-07 21:28 ` [Bug debug/48466] [4.4 " jakub at gcc dot gnu.org
2011-04-07 22:21 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).