From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5E0F43858412; Fri, 12 Nov 2021 09:33:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E0F43858412 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103202] [12 regression] gcc miscompiles ed-1.17 Date: Fri, 12 Nov 2021 09:33:46 +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: needs-bisection, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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: 12.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 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, 12 Nov 2021 09:33:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103202 --- Comment #4 from Richard Biener --- (In reply to Sergei Trofimovich from comment #3) > Created attachment 51776 [details] > main_loop_simpler.c >=20 > Attaching seemingly simpler example. I applied most inlines and simplified > loops as much as I could. It looks like VRP does something funny with: >=20 > while (n > 0) > { > while (n-- > 0) > { >=20 > Looking at 039t.mergephi1 >=20 > with -fno-tree-vrp: >=20 > --- no-vrp/ed-main_loop.c.039t.mergephi1 2021-11-12 09:07:55.120821967 > +0000 > +++ yes-vrp/ed-main_loop.c.039t.mergephi1 2021-11-12 09:07:55.186822973 > +0000 > @@ -93,7 +93,7 @@ > # np_6 =3D PHI > # n_8 =3D PHI > n_23 =3D n_8 + -1; > - if (n_8 > 0) > + if (n_8 !=3D 0) > goto ; [INV] > else > goto ; [INV] >=20 > I think our loop is executed with n =3D=3D -1 on real data and vrp provid= ed > incorrect range. But how would the inner loop be reachable with n =3D=3D -1?=