From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7479F3858C83; Fri, 8 Apr 2022 09:12:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7479F3858C83 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105198] [11/12 Regression] Wrong code for C loop (GCC 12 -O2, GCC 11 -O3) Date: Fri, 08 Apr 2022 09:12:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to Message-ID: In-Reply-To: References: 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: Fri, 08 Apr 2022 09:12:15 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105198 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org --- Comment #4 from Richard Biener --- Reduced testcase for the predictive commoning issue, fails with -O3 or -O2 -fno-tree-pre -fpredictive-commoning static __attribute__ ((noipa)) void next_set(int *x, int n, int k) { int j, tmp; j =3D k - 1; tmp =3D x[j]++; while(j > 0 && x[j] >=3D n - (k - 1 -j)) { j--; x[j]++; tmp =3D x[j]; } if (tmp !=3D 2 || j !=3D 1 || x[0] !=3D 0 || x[1] !=3D 2 || x[2] !=3D 5) __builtin_abort (); } int main() { int x[3] =3D {0, 1, 4}; next_set(x, 5, 3); return 0; }=