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/112771] during GIMPLE pass: bitintlower0 ICE: in build_bitint_type, at tree.cc:7178 with _BitInt(65535) and division by zero
Date: Fri, 01 Dec 2023 09:56:34 +0000	[thread overview]
Message-ID: <bug-112771-4-yfHfCDSxD2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112771-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 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:9bfebcb1b7ae4e7160644f2104424d6bab4a23f7

commit r14-6050-g9bfebcb1b7ae4e7160644f2104424d6bab4a23f7
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Dec 1 10:55:49 2023 +0100

    lower-bitint: Fix up handle_operand_addr for 0 constants [PR112771]

    handle_operand_addr for INTEGER_CSTs uses wi::min_precision (UNSIGNED
    for non-negative constants, SIGNED for negative ones) and from that
    computes mp as minimum number of limbs which can represent that value,
    and in some cases creates a test BITINT_TYPE with that precision to
    categorize it and decide based on that what types to use on the constant
    emitted into memory.  For the actual precisions (what will be passed
    to libgcc) it actually already uses MAX/MIN to adjust the corner cases:
              *prec = MAX (min_prec, 1);
    ...
              *prec = MIN ((int) -min_prec, -2);
    but for integer_zerop min_prec will be 0,
    mp = CEIL (min_prec, limb_prec) * limb_prec;
    will be also 0 and we ICE trying to build unsigned BITINT_TYPE with
    0 precision.

    Fixed thusly by noting even 0 has to be encoded at least as one limb.

    2023-12-01  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/112771
            * gimple-lower-bitint.cc (bitint_large_huge::handle_operand_addr):
            Use mp = 1 if it is zero.

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

  parent reply	other threads:[~2023-12-01  9:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 19:58 [Bug middle-end/112771] New: " zsojka at seznam dot cz
2023-11-30 16:52 ` [Bug middle-end/112771] " jakub at gcc dot gnu.org
2023-12-01  9:56 ` cvs-commit at gcc dot gnu.org [this message]
2023-12-01  9:58 ` 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-112771-4-yfHfCDSxD2@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).