From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0FCAE3858C2F; Tue, 16 May 2023 21:33:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0FCAE3858C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684272825; bh=AxYn7ZIPETlh7EW4mJaO8bZWwhZ4EZXO9Z1G2QEesMM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=V0u7Z1bej3acfJciR6HvJbJJG2Jo5otVo9SmVjDg7CHp+wx83slLlpqQkuFnxIRcu c8a3Cp+yAoKV6WBrwqZQ2SeqZMr/eaAiia2KFDgYsMBlL5Dh9zfX1c5+Is4vZtSBae YWMuk9fQNSBL7KgzH9JjfPCD01Xch6KFAN/ZUVDs= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106900] Regression after memchr optimization Date: Tue, 16 May 2023 21:33: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: 13.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to everconfirmed cf_reconfirmed_on 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=3D106900 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot = gnu.org Ever confirmed|0 |1 Last reconfirmed| |2023-05-16 --- Comment #4 from Andrew Pinski --- I am just going to test: diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index 06f19868ade..0326e6733e8 100644 --- a/gcc/tree-ssa-forwprop.cc +++ b/gcc/tree-ssa-forwprop.cc @@ -1231,14 +1231,14 @@ simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2) tree size =3D gimple_call_arg (stmt2, 2); /* Size must be a constant which is <=3D UNITS_PER_WORD and <=3D the string length. */ - if (TREE_CODE (size) !=3D INTEGER_CST || integer_zerop (size)) + if (TREE_CODE (size) !=3D INTEGER_CST) break; if (!tree_fits_uhwi_p (size)) break; unsigned HOST_WIDE_INT sz =3D tree_to_uhwi (size); - if (sz > UNITS_PER_WORD || sz >=3D slen) + if (sz =3D=3D 0 || sz > UNITS_PER_WORD || sz >=3D slen) break; tree ch =3D gimple_call_arg (stmt2, 1); This does not change the behavior of the code at all, just makes it obvious= sz cannot be 0 and therefore isize won't be 0 either.=