public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/48466] New: [4.4/4.5/4.6 Regression] Wrong variable locations at -O0 on i686
Date: Tue, 05 Apr 2011 18:13:00 -0000	[thread overview]
Message-ID: <bug-48466-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2011-04-05 18:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05 18:13 jakub at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-48466-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).