public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "roger at nextmovesoftware dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/109031] csmith: possible bad code with -O2 -fno-strict-aliasing since r13-254-gdd3c7873a61019e9 Date: Thu, 09 Mar 2023 13:41:54 +0000 [thread overview] Message-ID: <bug-109031-4-L6WTDpWXHO@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109031-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109031 Roger Sayle <roger at nextmovesoftware dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |roger at nextmovesoftware dot com Assignee|unassigned at gcc dot gnu.org |roger at nextmovesoftware dot com Keywords| |patch --- Comment #28 from Roger Sayle <roger at nextmovesoftware dot com> --- Doh! My apologies for this breakage. I'm currently testing the following fix: diff --git a/gcc/tree-chrec.cc b/gcc/tree-chrec.cc index f93d8dc..2f67581 100644 --- a/gcc/tree-chrec.cc +++ b/gcc/tree-chrec.cc @@ -623,7 +623,9 @@ chrec_apply (unsigned var, else if (operand_equal_p (CHREC_LEFT (chrec), chrecr) && TREE_CODE (x) == PLUS_EXPR && integer_all_onesp (TREE_OPERAND (x, 1)) - && !POINTER_TYPE_P (type)) + && !POINTER_TYPE_P (type) + && TYPE_PRECISION (TREE_TYPE (x)) + >= TYPE_PRECISION (type)) { /* We know the number of iterations can't be negative. So {a, +, a} (x-1) -> "a*x". */ The integer_all_onesp test is only equivalent to -1 when the TREE_TYPE (x) is the same width or wider than type. In this case, TREE_TYPE (x) is unsigned char and x is "zero+255", so performed in the wrong type (zero+255+1) becomes zero instead of zero+256.
next prev parent reply other threads:[~2023-03-09 13:41 UTC|newest] Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-05 21:26 [Bug c/109031] New: csmith: possible bad code with -O2 -fno-strict-aliasing dcb314 at hotmail dot com 2023-03-06 15:05 ` [Bug middle-end/109031] " dcb314 at hotmail dot com 2023-03-06 16:03 ` dcb314 at hotmail dot com 2023-03-06 17:43 ` dcb314 at hotmail dot com 2023-03-06 20:33 ` dcb314 at hotmail dot com 2023-03-06 20:41 ` pinskia at gcc dot gnu.org 2023-03-07 0:10 ` pinskia at gcc dot gnu.org 2023-03-08 11:10 ` dcb314 at hotmail dot com 2023-03-08 12:06 ` marxin at gcc dot gnu.org 2023-03-08 13:39 ` dcb314 at hotmail dot com 2023-03-08 13:43 ` marxin at gcc dot gnu.org 2023-03-08 13:56 ` dcb314 at hotmail dot com 2023-03-08 14:01 ` marxin at gcc dot gnu.org 2023-03-08 14:08 ` dcb314 at hotmail dot com 2023-03-08 14:10 ` marxin at gcc dot gnu.org 2023-03-08 14:16 ` dcb314 at hotmail dot com 2023-03-08 14:24 ` marxin at gcc dot gnu.org 2023-03-08 16:45 ` dcb314 at hotmail dot com 2023-03-08 17:12 ` dcb314 at hotmail dot com 2023-03-09 8:44 ` marxin at gcc dot gnu.org 2023-03-09 8:48 ` jakub at gcc dot gnu.org 2023-03-09 8:59 ` marxin at gcc dot gnu.org 2023-03-09 9:25 ` dcb314 at hotmail dot com 2023-03-09 9:41 ` [Bug middle-end/109031] csmith: possible bad code with -O2 -fno-strict-aliasing since r13-254-gdd3c7873a61019e9 marxin at gcc dot gnu.org 2023-03-09 9:45 ` dcb314 at hotmail dot com 2023-03-09 10:18 ` marxin at gcc dot gnu.org 2023-03-09 10:20 ` marxin at gcc dot gnu.org 2023-03-09 10:29 ` marxin at gcc dot gnu.org 2023-03-09 10:35 ` marxin at gcc dot gnu.org 2023-03-09 13:41 ` roger at nextmovesoftware dot com [this message] 2023-03-09 14:25 ` jakub at gcc dot gnu.org 2023-03-12 22:55 ` cvs-commit at gcc dot gnu.org 2023-03-14 7:33 ` roger at nextmovesoftware dot com
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-109031-4-L6WTDpWXHO@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: linkBe 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).