From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2AC703847718; Wed, 3 Apr 2024 12:27:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2AC703847718 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712147272; bh=umhPLL+dQ3OWL4a5zUaZzUW/0ndDRTJyRMjVb19/12k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=K97iAl0GSlD0zUeXYlbf0cQz9yDVN2YRMcKXt254Wt7f0TDmwzbCq+hPSlrMEQpOl 4wDjvWjKtRY69cVt2UpZMz5hvUZyxaBD1zWkW3h3r49BRcvvE2y8BCGAfu5O+1kxnq aPYIawVkDZLQ2JHfDApuMKuMKGw8C2GFTOjGtVLs= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114551] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2944 Date: Wed, 03 Apr 2024 12:27:51 +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: 14.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: P1 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114551 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org --- Comment #6 from Richard Biener --- It can be reproduced with -O2 -funswitch-loops -fsplit-loops. Loop splitting emits [local count: 14598063]: a.0_1 =3D a; _2 =3D a.0_1 + -1; a =3D _2; _24 =3D _2 <=3D 0; _10 =3D 2147483647 - _2; if (_10 <=3D 2) and the 2147483647 - _2 expression then overflows, so that's definitely wrong. This is built here: /* Build a condition that will skip the first loop when the guard condition won't ever be true (or false). */ gimple_seq stmts2; border =3D force_gimple_operand (border, &stmts2, true, NULL_TREE); if (stmts2)=20=20=20=20=20=20=20=20=20=20=20=20=20=20 or rather in split_at_bb_p and put into '*border'=