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 middle-end/113410] ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length
Date: Wed, 17 Jan 2024 12:57:50 +0000	[thread overview]
Message-ID: <bug-113410-4-4AL4xIXTlx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113410-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 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:a98a24ac65c1a0ee598e5b54d9e4c921a9744a08

commit r14-8185-ga98a24ac65c1a0ee598e5b54d9e4c921a9744a08
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jan 17 13:57:07 2024 +0100

    gimple-ssa-warn-access: Cast huge params to sizetype before using them in
maybe_check_access_sizes [PR113410]

    WHen a VLA is created with some very high precision size expression
    (say __int128, or _BitInt(65535) etc.), we cast it to sizetype, because
    we can't have arrays longer than what can be expressed in sizetype.

    But the maybe_check_access_sizes code when trying to determine ranges
    wasn't doing this but was using fixed buffers for the sizes.  While
    __int128 could still be handled (fit into the buffers), obviously
    arbitrary _BitInt parameter ranges can't, they can be in the range of
    up to almost 20KB per number.  It doesn't make sense to print such
    ranges though, no array can be larger than sizetype precision, and
    ranger's range_of_expr can handle NOP_EXPRs/CONVERT_EXPRs wrapping a
    PARM_DECL just fine, so the following patch just casts the excessively
    large counters for the range determination purposes to sizetype.

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

            PR middle-end/113410
            * gimple-ssa-warn-access.cc
(pass_waccess::maybe_check_access_sizes):
            If access_nelts is integral with larger precision than sizetype,
            fold_convert it to sizetype.

            * gcc.dg/bitint-72.c: New test.

  parent reply	other threads:[~2024-01-17 12:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 20:58 [Bug tree-optimization/113410] New: " zsojka at seznam dot cz
2024-01-16  0:04 ` [Bug middle-end/113410] " pinskia at gcc dot gnu.org
2024-01-16 18:34 ` jakub at gcc dot gnu.org
2024-01-17 12:57 ` cvs-commit at gcc dot gnu.org [this message]
2024-01-17 12:58 ` jakub at gcc dot gnu.org
2024-01-20 17:11 ` pinskia 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-113410-4-4AL4xIXTlx@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).