From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27867 invoked by alias); 8 Jun 2013 19:25:19 -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 Received: (qmail 27849 invoked by uid 48); 8 Jun 2013 19:25:16 -0000 From: "dhazeghi at yahoo dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/57569] New: wrong code for struct copy at -O3 on x86_64-linux Date: Sat, 08 Jun 2013 19:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dhazeghi at yahoo dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg00418.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57569 Bug ID: 57569 Summary: wrong code for struct copy at -O3 on x86_64-linux Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: dhazeghi at yahoo dot com The following code is miscompiled with current gcc-trunk on x86_64-linux at -O3 optimization level in 32-bit mode, outputting garbage (rather than 0). This is a regression from 4.7. $ gcc-trunk -v gcc version 4.9.0 20130608 (experimental) [trunk revision 199849] (GCC) $ gcc-trunk -O2 -m32 reduced.c $ ./a.out 0 $ gcc-4.7 -O3 -m32 reduced.c $ ./a.out 0 $ gcc-trunk -O3 -m32 reduced.c $ ./a.out 134519796 ---------------------------- int printf (const char *, ...); struct S { int f0; } a; int b, e, *d = &b, f; void fn1 () { int **g[9][6]; int ***h = &g[6][3]; for (; e < 9; e++) { f = 0; for (; f < 6; f++) g[e][f] = &d; } ***h = 0; } void fn2 () { fn1 (); struct S c[4][10] = {}; a = c[3][9]; } int main () { fn2 (); printf ("%d\n", a.f0); return 0; }