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/112733] [14 Regression] ICE: Segmentation fault in wide-int.cc during GIMPLE pass: sccp
Date: Sat, 16 Dec 2023 00:38:19 +0000	[thread overview]
Message-ID: <bug-112733-4-4SJhcPlpAB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112733-4@http.gcc.gnu.org/bugzilla/>

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

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

https://gcc.gnu.org/g:4bf040fcd23aaa7d8c4873d1170776ab117bc213

commit r12-10055-g4bf040fcd23aaa7d8c4873d1170776ab117bc213
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Nov 29 12:26:50 2023 +0100

    fold-const: Fix up multiple_of_p [PR112733]

    We ICE on the following testcase when wi::multiple_of_p is called on
    widest_int 1 and -128 with UNSIGNED.  I still need to work on the
    actual wide-int.cc issue, the latest patch attached to the PR regressed
    bitint-{38,39}.c, so will need to debug that, but there is a clear bug
    on the fold-const.cc side as well - widest_int is a signed representation
    by definition, using UNSIGNED with it certainly doesn't match what was
    intended, because -128 as the second operand effectively means unsigned
    131072 bit 0xfffff............ffff80 integer, not the signed char -128
    that appeared in the source.

    In the INTEGER_CST case a few lines above this we already use
        case INTEGER_CST:
          if (TREE_CODE (bottom) != INTEGER_CST || integer_zerop (bottom))
            return false;
          return wi::multiple_of_p (wi::to_widest (top), wi::to_widest
(bottom),
                                    SIGNED);
    so I think using SIGNED with widest_int is best there (compared to the
    other choices in the PR).

    2023-11-29  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/112733
            * fold-const.cc (multiple_of_p): Pass SIGNED rather than
            UNSIGNED for wi::multiple_of_p on widest_int arguments.

            * gcc.dg/pr112733.c: New test.

    (cherry picked from commit 5c95bf945c632925efba86dd5dceccdb9da8884c)

  parent reply	other threads:[~2023-12-16  0:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 19:12 [Bug middle-end/112733] New: " patrick at rivosinc dot com
2023-11-27 19:16 ` [Bug middle-end/112733] " pinskia at gcc dot gnu.org
2023-11-27 19:16 ` pinskia at gcc dot gnu.org
2023-11-27 19:21 ` pinskia at gcc dot gnu.org
2023-11-27 19:25 ` pinskia at gcc dot gnu.org
2023-11-28  9:02 ` rguenth at gcc dot gnu.org
2023-11-28  9:35 ` jakub at gcc dot gnu.org
2023-11-28 14:34 ` jakub at gcc dot gnu.org
2023-11-28 14:48 ` jakub at gcc dot gnu.org
2023-11-28 15:56 ` jakub at gcc dot gnu.org
2023-11-28 16:01 ` jakub at gcc dot gnu.org
2023-11-28 17:37 ` jakub at gcc dot gnu.org
2023-11-28 17:43 ` jakub at gcc dot gnu.org
2023-11-29  9:29 ` jakub at gcc dot gnu.org
2023-11-29 11:27 ` cvs-commit at gcc dot gnu.org
2023-11-30  8:15 ` cvs-commit at gcc dot gnu.org
2023-11-30  8:16 ` jakub at gcc dot gnu.org
2023-12-15 14:05 ` cvs-commit at gcc dot gnu.org
2023-12-16  0:38 ` cvs-commit at gcc dot gnu.org [this message]
2023-12-17 13:55 ` cvs-commit 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-112733-4-4SJhcPlpAB@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).