From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4076 invoked by alias); 15 May 2013 19:41:18 -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 4057 invoked by uid 48); 15 May 2013 19:41:15 -0000 From: "dhazeghi at yahoo dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/57300] New: statement in expression miscompiled at -O3 in 32-bit mode Date: Wed, 15 May 2013 19:41: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-05/txt/msg01070.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57300 Bug ID: 57300 Summary: statement in expression miscompiled at -O3 in 32-bit mode 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 testcase appears to be miscompiled with gcc 4.8 and trunk on x86_64-linux-gnu at -O3 optimization level in 32-bit mode. In 64-bit mode, at lower optimization, or with gcc 4.7 and earlier it works correctly. $ gcc-trunk -v Target: x86_64-unknown-linux-gnu ... gcc version 4.9.0 20130515 (experimental) [trunk revision 198926] (GCC) $ gcc-trunk -O2 -m32 small.c $ ./a.out 1 $ gcc-trunk -O3 -m64 small.c $ ./a.out 1 $ gcc-4.7 -O3 -m32 small.c $ ./a.out 1 $ gcc-trunk -O3 -m32 small.c $ ./a.out 0 $ ------------------------------ int printf (const char *, ...); int a, b, e; long long c; int d[10]; int main () { int *f = &a; e = 0; for (; e < 10; e++) d[e] = 1; if (d[0]) c = ( { int g = *f = ( { b == 0 || 1 % b; }); g; } ); printf ("%d\n", a); return 0; }