From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A11B13858D28; Wed, 8 Dec 2021 09:15:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A11B13858D28 From: "siarhei.siamashka at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103615] New: [8/9 Regression] wrong code with "-O3" or "-O1 -ftree-vectorize" on x86_64-pc-linux-gnu Date: Wed, 08 Dec 2021 09:15:21 +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: 9.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: siarhei.siamashka at gmail dot com 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, 08 Dec 2021 09:15:21 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103615 Bug ID: 103615 Summary: [8/9 Regression] wrong code with "-O3" or "-O1 -ftree-vectorize" on x86_64-pc-linux-gnu Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: siarhei.siamashka at gmail dot com Target Milestone: --- A reduced testcase from https://codeforces.com/blog/entry/97433 $ cat test.c int z =3D 5; int a[6] =3D {0, 0, 0, 0, 0, 1}; int main() { for (int x =3D 5; x; x--) for (int y =3D z; y >=3D x; y--) a[y - x] +=3D a[y]; if (a[0] !=3D 7) __builtin_abort (); return 0; } $ gcc-7.3.0 -O3 test.c && ./a.out $ gcc-8.3.0 -O3 test.c && ./a.out Aborted $ gcc-9.3.0 -O3 test.c && ./a.out Aborted $ gcc-9.4.1 -O3 test.c && ./a.out Aborted $ gcc-10.3.0 -O3 test.c && ./a.out Only GCC versions 8.x and 9.x are affected and the bug is triggered by "-O3= " or "-O1 -ftree-vectorize" optimization option.=