public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/113462] ICE: in handle_cast, at gimple-lower-bitint.cc:1539 at -O with _BitInt() in a struct
Date: Tue, 23 Jan 2024 08:05:14 +0000	[thread overview]
Message-ID: <bug-113462-4-QLileKxoRL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113462-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:5015015ae6b29b3f1734c7693ba25b88cdd531a1

commit r14-8349-g5015015ae6b29b3f1734c7693ba25b88cdd531a1
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jan 23 09:02:48 2024 +0100

    fold-const: Fold larger VIEW_CONVERT_EXPRs [PR113462]

    On Mon, Jan 22, 2024 at 11:27:52AM +0100, Richard Biener wrote:
    > We run into
    >
    > static tree
    > native_interpret_int (tree type, const unsigned char *ptr, int len)
    > {
    > ...
    >   if (total_bytes > len
    >       || total_bytes * BITS_PER_UNIT > HOST_BITS_PER_DOUBLE_INT)
    >     return NULL_TREE;
    >
    > OTOH using a V_C_E to "truncate" a _BitInt looks wrong?  OTOH the
    > check doesn't really handle native_encode_expr using the "proper"
    > wide_int encoding however that's exactly handled.  So it might be
    > a pre-existing issue that's only uncovered by large _BitInts
    > (__int128 might show similar issues?)

    I guess the || total_bytes * BITS_PER_UNIT > HOST_BITS_PER_DOUBLE_INT
    conditions make no sense, all we care is whether it fits in the buffer
    or not.
    But then there is
    fold_view_convert_expr
    (and other spots) which use
      /* We support up to 1024-bit values (for GCN/RISC-V V128QImode).  */
      unsigned char buffer[128];
    or something similar.
    This patch fixes even that by using a XALLOCAVEC allocated buffer
    if the type size is 129 .. 8192 bytes.

    2024-01-22  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/113462
            * fold-const.cc (native_interpret_int): Don't punt if total_bytes
            is larger than HOST_BITS_PER_DOUBLE_INT / BITS_PER_UNIT.
            (fold_view_convert_expr): Use XALLOCAVEC buffers for types with
            sizes between 129 and 8192 bytes.

      parent reply	other threads:[~2024-01-23  8:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18  2:43 [Bug tree-optimization/113462] New: " zsojka at seznam dot cz
2024-01-18 14:03 ` [Bug tree-optimization/113462] " jakub at gcc dot gnu.org
2024-01-19 17:41 ` jakub at gcc dot gnu.org
2024-01-20 11:37 ` cvs-commit at gcc dot gnu.org
2024-01-20 11:38 ` jakub at gcc dot gnu.org
2024-01-20 17:11 ` pinskia at gcc dot gnu.org
2024-01-23  8:05 ` cvs-commit at gcc dot gnu.org [this message]

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-113462-4-QLileKxoRL@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).