From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 370 invoked by alias); 5 Apr 2011 18:13:24 -0000 Received: (qmail 359 invoked by uid 22791); 5 Apr 2011 18:13:24 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Apr 2011 18:13:19 +0000 From: "jakub at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 05 Apr 2011 18:13:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg00471.txt.bz2 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