From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 01CA63858434; Wed, 23 Mar 2022 09:45:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01CA63858434 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/104986] [12 Regression] bogus writing 1 byte into a region of size 0 with -fwrapv and -O2 -fpeel-loops since r12-4698-gf6d012338bf87f42 Date: Wed, 23 Mar 2022 09:45:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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: Wed, 23 Mar 2022 09:45:04 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104986 Aldy Hernandez changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amacleod at redhat dot com, | |siddhesh at gcc dot gnu.org --- Comment #2 from Aldy Hernandez --- [Siddhesh, I don't know if this is something you're looking at. If not, fe= el free to unsubscribe.] This may have first been visible with r12-4698-gf6d012338bf87f42, but it is= n't threader related as it can be reproduced with -fno-thread-jumps. I can actually reproduce it without VRP[12] (but not without evrp). + ./cc1 a.c -fdump-tree-all-details -quiet -I/tmp -O2 -fpeel-loops -fwrapv -fno-thread-jumps -fdisable-tr ee-vrp2 -fdisable-tree-vrp1 cc1: note: disable pass tree-vrp2 for functions in the range of [0, 4294967= 295] cc1: note: disable pass tree-vrp1 for functions in the range of [0, 4294967= 295] a.c: In function =E2=80=98inetnot=E2=80=99: a.c:12:14: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=3D] etc etc Disabling evrp causes the problem to go away, but all these middle end warn= ings are very sensitive to better ranges, so who knows. For that matter, the only transformation evrp is doing is correct: @@ -74,7 +90,7 @@ : # nb_8 =3D PHI nb_23 =3D nb_8 + -1; - if (nb_8 > 0) + if (nb_8 !=3D 0) goto ; [INV] else goto ; [INV] ...which is merely changing the conditional in the decreasing loop from > 0 into !=3D 0. It looks like a problem elsewhere.=