public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "k.even-mendoza at imperial dot ac.uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/103813] New: Crash in decompose, at wide-int.h:984 fold-const
Date: Wed, 22 Dec 2021 22:29:17 +0000	[thread overview]
Message-ID: <bug-103813-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 103813
           Summary: Crash in decompose, at wide-int.h:984 fold-const
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: k.even-mendoza at imperial dot ac.uk
  Target Milestone: ---

The following code crashed GCC 11 and 12, with -O1, -O2, -O3 and -Os but -O0
works just fine.

struct a d;
struct a {
  int b;
  int c[]
} main() {
  d.c[268435456] || d.c[1];
}

I tested it with GCC 11.1.0 Ubuntu 20.04 and GCC 12.0.0 20211216 (experimental)
Ubuntu 18. I can see other bugs open but none related to fold-const. 

With that trace:
fuzzer-file-159198.c:6:3: internal compiler error: in decompose, at
wide-int.h:984
    6 |   d.c[268435456] || d.c[1];
      |   ^
0x6f4748 wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> >
>::decompose(long*, unsigned int, generic_wide_int<wide_int_ref_storage<false,
false> > const&)
        .././../gcc-source/gcc/wide-int.h:984
0x6fbea1 wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> >
>::decompose(long*, unsigned int, generic_wide_int<wide_int_ref_storage<false,
false> > const&)
        .././../gcc-source/gcc/tree.h:3555
0x6fbea1 wide_int_ref_storage<false,
false>::wide_int_ref_storage<generic_wide_int<wide_int_ref_storage<false,
false> > >(generic_wide_int<wide_int_ref_storage<false, false> > const&,
unsigned int)
        .././../gcc-source/gcc/wide-int.h:1034
0x6fbea1 generic_wide_int<wide_int_ref_storage<false, false>
>::generic_wide_int<generic_wide_int<wide_int_ref_storage<false, false> >
>(generic_wide_int<wide_int_ref_storage<false, false> > const&, unsigned int)
        .././../gcc-source/gcc/wide-int.h:790
0x6fbea1 unsigned long
wi::extract_uhwi<generic_wide_int<wide_int_ref_storage<false, false> >
>(generic_wide_int<wide_int_ref_storage<false, false> > const&, unsigned int,
unsigned int)
        .././../gcc-source/gcc/wide-int.h:3212
0x6fbea1 unextend
        .././../gcc-source/gcc/fold-const.c:6110
0xb991ed fold_truth_andor_1
        .././../gcc-source/gcc/fold-const.c:6461
0xb9a4bd fold_truth_andor
        .././../gcc-source/gcc/fold-const.c:9687
0xb7aaf4 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
        .././../gcc-source/gcc/fold-const.c:12036
0xb82629 fold_build2_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
        .././../gcc-source/gcc/fold-const.c:13781
0x9358b2 c_fully_fold_internal
        .././../gcc-source/gcc/c/c-fold.c:545
0x936089 c_fully_fold(tree_node*, bool, bool*, bool)
        .././../gcc-source/gcc/c/c-fold.c:125
0x8d00ec c_process_expr_stmt(unsigned int, tree_node*)
        .././../gcc-source/gcc/c/c-typeck.c:11320
0x8d03cd c_finish_expr_stmt(unsigned int, tree_node*)
        .././../gcc-source/gcc/c/c-typeck.c:11365
0x90409f c_parser_statement_after_labels
        .././../gcc-source/gcc/c/c-parser.c:6261
0x9067ac c_parser_compound_statement_nostart
        .././../gcc-source/gcc/c/c-parser.c:5798
0x927f75 c_parser_compound_statement
        .././../gcc-source/gcc/c/c-parser.c:5607
0x929b2a c_parser_declaration_or_fndef
        .././../gcc-source/gcc/c/c-parser.c:2544
0x932583 c_parser_external_declaration
        .././../gcc-source/gcc/c/c-parser.c:1779
0x933093 c_parser_translation_unit
        .././../gcc-source/gcc/c/c-parser.c:1652
Please submit a full bug report,

             reply	other threads:[~2021-12-22 22:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22 22:29 k.even-mendoza at imperial dot ac.uk [this message]
2021-12-22 22:36 ` [Bug middle-end/103813] " pinskia at gcc dot gnu.org
2021-12-22 22:37 ` [Bug middle-end/103813] [11/12 Regression] " pinskia at gcc dot gnu.org
2021-12-22 22:58 ` pinskia at gcc dot gnu.org
2021-12-23  8:34 ` [Bug middle-end/103813] [11/12 Regression] Crash in decompose, at wide-int.h:984 fold-const since r11-5271-g4866b2f5db117f9e marxin at gcc dot gnu.org
2021-12-27 16:48 ` jakub at gcc dot gnu.org
2021-12-28 16:41 ` cvs-commit at gcc dot gnu.org
2021-12-28 16:43 ` [Bug middle-end/103813] [11 " jakub at gcc dot gnu.org
2022-01-04 13:20 ` rguenth at gcc dot gnu.org
2022-01-24  9:20 ` cvs-commit at gcc dot gnu.org
2022-01-24  9:30 ` 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-103813-4@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).