public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-106900-4-rMU1kN3MSg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106900-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106900

Andrew Pinski <pinskia at gcc dot gnu.org> 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 <pinskia at gcc dot gnu.org> ---
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 = gimple_call_arg (stmt2, 2);
          /* Size must be a constant which is <= UNITS_PER_WORD and
             <= the string length.  */
-         if (TREE_CODE (size) != INTEGER_CST || integer_zerop (size))
+         if (TREE_CODE (size) != INTEGER_CST)
            break;

          if (!tree_fits_uhwi_p (size))
            break;

          unsigned HOST_WIDE_INT sz = tree_to_uhwi (size);
-         if (sz > UNITS_PER_WORD || sz >= slen)
+         if (sz == 0 || sz > UNITS_PER_WORD || sz >= slen)
            break;

          tree ch = 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.

  parent reply	other threads:[~2023-05-16 21:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-10  5:36 [Bug tree-optimization/106900] New: " jbglaw@lug-owl.de
2022-09-10  5:47 ` [Bug tree-optimization/106900] " pinskia at gcc dot gnu.org
2022-09-10  5:48 ` pinskia at gcc dot gnu.org
2023-02-25 19:33 ` jbglaw@lug-owl.de
2023-05-16 21:33 ` pinskia at gcc dot gnu.org [this message]
2023-05-17  4:24 ` pinskia at gcc dot gnu.org
2023-05-17 15:03 ` cvs-commit at gcc dot gnu.org
2023-05-17 15:05 ` pinskia at gcc dot gnu.org
2023-05-17 18:40 ` jbglaw@lug-owl.de
2023-05-18 15:47 ` jbglaw@lug-owl.de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-106900-4-rMU1kN3MSg@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).