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/105532] [11/12/13 Regression] UBSAN: gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int'
Date: Wed, 02 Nov 2022 01:51:54 +0000	[thread overview]
Message-ID: <bug-105532-4-Rx47kae4wS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105532-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
            Summary|UBSAN: gcc/hwint.h:293:61:  |[11/12/13 Regression]
                   |runtime error: shift        |UBSAN: gcc/hwint.h:293:61:
                   |exponent 64 is too large    |runtime error: shift
                   |for 64-bit type 'long       |exponent 64 is too large
                   |unsigned int'               |for 64-bit type 'long
                   |                            |unsigned int'
   Target Milestone|---                         |11.4
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|                            |2022-11-02
             Status|UNCONFIRMED                 |NEW
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=96688

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
The bug is either in tree_nonzero_bits and should not be doing:
  return wi::shwi (-1, TYPE_PRECISION (TREE_TYPE (t)));

For vector types or is in match.pd where it should not be calling
tree_nonzero_bits for vector types.
/* ~(X >> Y) -> ~X >> Y if ~X can be simplified.  */
(simplify
 (bit_not (rshift:s @0 @1))
  (if (!TYPE_UNSIGNED (TREE_TYPE (@0)))
   (rshift (bit_not! @0) @1)
   /* For logical right shifts, this is possible only if @0 doesn't
      have MSB set and the logical right shift is changed into
      arithmetic shift.  */
   (if (!wi::neg_p (tree_nonzero_bits (@0)))
    (with { tree stype = signed_type_for (TREE_TYPE (@0)); }
     (convert (rshift (bit_not! (convert:stype @0)) @1))))))

I almost want to say we should put an gcc_assert in tree_nonzero_bits for when
it gets called with vector or complex types (maybe even real types).

The match.pd pattern was added with r11-6663-g8f8762a2e8659c .

  parent reply	other threads:[~2022-11-02  1:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 10:54 [Bug tree-optimization/105532] New: " zsojka at seznam dot cz
2022-11-02  1:42 ` [Bug tree-optimization/105532] " pinskia at gcc dot gnu.org
2022-11-02  1:51 ` pinskia at gcc dot gnu.org [this message]
2022-11-02  6:36 ` [Bug tree-optimization/105532] [11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-11-02 16:24 ` pinskia at gcc dot gnu.org
2022-11-02 16:30 ` pinskia at gcc dot gnu.org
2022-11-02 21:47 ` pinskia at gcc dot gnu.org
2022-12-20 13:45 ` rguenth at gcc dot gnu.org
2022-12-21 18:33 ` cvs-commit at gcc dot gnu.org
2022-12-21 18:34 ` [Bug tree-optimization/105532] [11/12 " pinskia at gcc dot gnu.org
2023-03-11  1:29 ` cvs-commit at gcc dot gnu.org
2023-03-11  1:30 ` [Bug tree-optimization/105532] [11 " pinskia at gcc dot gnu.org
2023-05-29 10:06 ` 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-105532-4-Rx47kae4wS@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).