public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [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

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).