public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/113756] [14 regression] Wrong code at -O2 on x86_64-linux-gnu since r14-2780-g39f117d6c87
Date: Tue, 06 Feb 2024 15:59:01 +0000	[thread overview]
Message-ID: <bug-113756-4-2OqRMdQ80T@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113756-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think the issue is that ABSU_EXPR is an unary operation with signed operand
and unsigned result.  And update_known_bitmask was using result rather than
operand sign to the operand's value/mask, so I think
--- gcc/range-op.cc.jj  2024-01-03 11:51:28.199777434 +0100
+++ gcc/range-op.cc     2024-02-06 16:51:55.549127825 +0100
@@ -435,8 +435,10 @@ update_known_bitmask (irange &r, tree_co
       bit_value_unop (code, sign, prec, &widest_value, &widest_mask,
                      TYPE_SIGN (lh.type ()),
                      TYPE_PRECISION (lh.type ()),
-                     widest_int::from (lh_bits.value (), sign),
-                     widest_int::from (lh_bits.mask (), sign));
+                     widest_int::from (lh_bits.value (),
+                                       TYPE_SIGN (lh.type ())),
+                     widest_int::from (lh_bits.mask (),
+                                       TYPE_SIGN (lh.type ())));
       break;
     case GIMPLE_BINARY_RHS:
       bit_value_binop (code, sign, prec, &widest_value, &widest_mask,
ought to fix this.  Of course even better would be rewrite tree-ssa-cpp.cc to
use wide_int rather than widest_int, but I'm afraid that is stage1 material.

  parent reply	other threads:[~2024-02-06 15:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-04 14:14 [Bug tree-optimization/113756] New: " shaohua.li at inf dot ethz.ch
2024-02-04 18:13 ` [Bug tree-optimization/113756] " pinskia at gcc dot gnu.org
2024-02-04 18:17 ` pinskia at gcc dot gnu.org
2024-02-05  9:04 ` [Bug tree-optimization/113756] [14 regression] " rguenth at gcc dot gnu.org
2024-02-06 15:59 ` jakub at gcc dot gnu.org [this message]
2024-02-06 16:05 ` jakub at gcc dot gnu.org
2024-02-07  9:59 ` cvs-commit at gcc dot gnu.org
2024-02-07 10:00 ` jakub at gcc dot gnu.org

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-113756-4-2OqRMdQ80T@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).