From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14953 invoked by alias); 20 Oct 2014 11:24:42 -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 14927 invoked by uid 48); 20 Oct 2014 11:24:38 -0000 From: "asolokha at gmx dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/63602] New: Wrong code w/ -O2 -ftree-loop-linear Date: Mon, 20 Oct 2014 11:30:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: asolokha at gmx 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: 2014-10/txt/msg01526.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63602 Bug ID: 63602 Summary: Wrong code w/ -O2 -ftree-loop-linear Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com gcc produces wrong code w/ -ftree-loop-linear -O2 (and above) for the following reduced case: int sx; int bn; int vz = 1; int *volatile n6 = &bn; int main(void) { for (int i = 0; i < 3; ++i) { sx = vz; vz = bn; } return sx; } It struck me first w/ gcc-4.10.0-alpha20140810, but today I've reproduced it w/ 4.8.3, 4.9.1 and 5-alpha20141019, so I'm not marking it as a regression. Expected results: % gcc-5.0_alpha20141019 -O2 -o good 963b8772.c % ./good % echo $? 0 Actual results: % gcc-5.0_alpha20141019 -O2 -ftree-loop-linear -o bad 963b8772.c % ./bad % echo $? 1