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 06:36:40 +0000	[thread overview]
Message-ID: <bug-105532-4-UCuo8iNYBx@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
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I am going to take care of this at least for GCC 13.

There is another invalid use here too:
/* Common POPCOUNT/PARITY simplifications.  */
/* popcount(X&C1) is (X>>C2)&1 when C1 == 1<<C2.  Same for parity(X&C1).  */
(for pfun (POPCOUNT PARITY)
  (simplify
    (pfun @0)
    (with { wide_int nz = tree_nonzero_bits (@0); }
      (switch
        (if (nz == 1)
          (convert @0))
        (if (wi::popcount (nz) == 1)
          (with { tree utype = unsigned_type_for (TREE_TYPE (@0)); }
            (convert (rshift:utype (convert:utype @0)
                                   { build_int_cst (integer_type_node,
                                                    wi::ctz (nz)); }))))))))

Found while running the testsuite on x86_64.

Another one:
/* POPCOUNT simplifications.  */
/* popcount(X) + popcount(Y) is popcount(X|Y) when X&Y must be zero.  */
(simplify
  (plus (POPCOUNT:s @0) (POPCOUNT:s @1))
  (if (wi::bit_and (tree_nonzero_bits (@0), tree_nonzero_bits (@1)) == 0)
    (POPCOUNT (bit_ior @0 @1))))


Those 3 are only ones I see in match.pd (the other uses of tree_nonzero_bits
checks the type before the call).

  parent reply	other threads:[~2022-11-02  6:36 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 ` [Bug tree-optimization/105532] [11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-11-02  6:36 ` pinskia at gcc dot gnu.org [this message]
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-UCuo8iNYBx@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).