From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21036 invoked by alias); 8 Jun 2013 19:16:15 -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 21008 invoked by uid 48); 8 Jun 2013 19:16:10 -0000 From: "dhazeghi at yahoo dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/57568] New: wrong code for assignment in conditional at -Os Date: Sat, 08 Jun 2013 19:16: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/msg00417.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57568 Bug ID: 57568 Summary: wrong code for assignment in conditional at -Os 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 by gcc trunk and 4.8 on x86_64-linux at -Os and above optimization levels in 32-bit mode (should print nothing). This is a regression from 4.7.x. $ gcc-trunk -v gcc version 4.9.0 20130608 (experimental) [trunk revision 199849] (GCC) $ gcc-trunk -O1 -m32 reduced.c $ ./a.out $ gcc-4.7 -Os -m32 reduced.c $ ./a.out $ gcc-trunk -Os -m32 reduced.c $ ./a.out 1 $ --------------- int printf (const char *, ...); int a[6][9] = {}; int b = 1; int *c = &a[3][5]; int main () { if (b) if (*c = *c + *c) printf ("%d\n", a[3][5]); return 0; }