From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D6183385802D; Mon, 23 Nov 2020 17:13:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6183385802D From: "acoplan at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/97960] New: [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d Date: Mon, 23 Nov 2020 17:13:02 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: acoplan at gcc dot gnu.org 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: Mon, 23 Nov 2020 17:13:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97960 Bug ID: 97960 Summary: [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: acoplan at gcc dot gnu.org Target Milestone: --- GCC miscompiles the following C++ testcase at -O3 (reproduced on both x86 a= nd aarch64): const int &c(const int &d, const int &f) { if (d < f) return f; return d; } short a[575]; unsigned b[25]; unsigned char g; int main() { for (int e =3D 0; e < 23; ++e) a[e * 23] =3D 16137; for (signed char h =3D c(g, 253) + 3; h < 24; h++) b[h] =3D 1064739102; for (int e =3D 0; e < 23; ++e) if (a[e * 23] !=3D 16137) __builtin_abort(); } When compiled with -O{0,g,s,1,2} (with or without -ftree-vectorize), the program exits cleanly, but aborts when compiled with -O3 since the above revision. The program also exits cleanly when compiled with clang on x86 and aarch64 at various optimization levels.=