From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D785A3857C66; Wed, 14 Jul 2021 02:50:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D785A3857C66 From: "qrzhang at gatech dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101445] New: wrong code at -O3 on x86_64-linux-gnu Date: Wed, 14 Jul 2021 02:50:09 +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: qrzhang at gatech dot edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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 target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 02:50:10 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101445 Bug ID: 101445 Summary: wrong code at -O3 on x86_64-linux-gnu Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: qrzhang at gatech dot edu Target Milestone: --- It appears to be a recent regression. Note that -O2 works fine. $ gcc-trunk -v Supported LTO compression algorithms: zlib gcc version 12.0.0 20210713 (experimental) [master revision 7670b6633e5:d2f95d2ac56:1583b8bff0be7e41aa721dde79f90ca0763bd4e2] (GCC) $ gcc-trunk abc.c ; ./a.out 0 0 0 0 0 0 0 $ gcc-trunk -O3 abc.c ; ./a.out 0 0 3 0 0 0 0 $ cat abc.c int a[35] =3D {1, 1, 3}; char b =3D 4; int c, d; int main() { char e; for (; b >=3D 0; b--) { e =3D 3; for (; e >=3D 0; e--) a[b * 5 + e] =3D a[b * 5 + e + 1]; } for (; c < 5; c++) ; for (; d < 7; d++) printf("%d\n", a[c * d]); }=