From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A968138582A4; Sat, 8 Jul 2023 01:08:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A968138582A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688778524; bh=ZtkWpDPG23VzQ+EkXafeWs+zVEUVp2He2JdwyQXUI90=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cTf7BqKzgFA/BSPz5PeKFIZRZwbYIs96LRG8hn+nAZ96NBSaRr6HchpWzDSiZO/F5 TqMMetjFMdtP2ul6KqSGvLNqSvffEKIqtbZikmA7wQqFGI1HiUgVZ8f/+n4JjoRuI8 qmovX+8fL5HTXPT8JFKwSsd5OuqOIeoefad8WwsY= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110582] [14 Regression] Wrong code at -O2/3 on x86_64-linux-gnu Date: Sat, 08 Jul 2023 01:08:44 +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: needs-bisection, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D110582 --- Comment #3 from Andrew Pinski --- (In reply to Richard Biener from comment #2) > It works with -fno-tree-loop-optimize but the difference from loop opts is > just So changing it to what -ftree-loop-optimize, it still passes with -fno-tree-loop-optimize (which is even odder): ``` int a, b; int main() { char c =3D a =3D 0; unsigned char t =3D 253; for (; t !=3D 0; t --){ int d =3D 2; d ^=3D 2 && a; b =3D a =3D=3D 0 ? d : d / a; a =3D b; } for (; (1 + 95 << 24) + b + 1 + 686658714L + b - 2297271457;) ; } ``` The difference in this case is: + unsigned charD.20 ivtmp_32; + unsigned charD.20 ivtmp_33; ... - # RANGE [irange] unsigned char [1, 253] - # t_19 =3D PHI # .MEM_20 =3D PHI <.MEM_20(5), .MEM_11(D)(2)> # a_lsm.11_2 =3D PHI + # ivtmp_33 =3D PHI ... - # RANGE [irange] unsigned char [0, 252] - t_16 =3D t_19 + 255; - if (t_16 !=3D 0) + ivtmp_32 =3D ivtmp_33 - 1; + if (ivtmp_32 !=3D 0) ``` The only thing I can of which might be causing the issue is +255 vs -1 here= .=