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/105232] New: ICE in tree_to_poly_int64, at tree.cc:3224
Date: Mon, 11 Apr 2022 20:28:37 +0000	[thread overview]
Message-ID: <bug-105232-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 105232
           Summary: ICE in tree_to_poly_int64, at tree.cc:3224
           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-12 with all flags, and gcc-11 with -O1, -O2, -O3
and -Os but works fine with -O0. gcc-10 and below works fine.

===
c;
#define d(expr, e)                                                            
\
  char *f = expr;                                                             
\
  strlen(f) ?: ++c;
struct {
  char a[0], b[1537228674000000000]
} cma[] = {{}, {}, {}, {}, {}, {}};
g() { d(cma[4].a, ) }
===

crashed with:
/home/user42/data/gcc-csmith-1201/gcc-install/bin/gcc -O2 fuzzer-file-3200.c
...
fuzzer-file-3200-1.c:8:7: note: in expansion of macro ‘d’
    8 | g() { d(cma[4].a, ) }
      |       ^
during GIMPLE pass: waccess
fuzzer-file-3200-1.c:8:1: internal compiler error: in tree_to_poly_int64, at
tree.cc:3224
    8 | g() { d(cma[4].a, ) }
      | ^
0x7e75cb tree_to_poly_int64(tree_node const*)
        .././../gcc-source/gcc/tree.cc:3224
0x7e75cb tree_to_poly_int64(tree_node const*)
        .././../gcc-source/gcc/tree.cc:3222
...
0xc0ffb8 check_builtin
        .././../gcc-source/gcc/gimple-ssa-warn-access.cc:3181
0xc0ffb8 check_call
        .././../gcc-source/gcc/gimple-ssa-warn-access.cc:4280
0xc0ffb8 check_block
        .././../gcc-source/gcc/gimple-ssa-warn-access.cc:4393
0xc0ffb8 execute
        .././../gcc-source/gcc/gimple-ssa-warn-access.cc:4742

===========================
With -O0 it ends without crashing and prints the right error:
gcc-11 -O0 fuzzer-file-3200.c
...
fuzzer-file-3200.c:8:7: note: in expansion of macro ‘d’
    8 | g() { d(cma[4].a, ) }
      |       ^
fuzzer-file-3200.c: At top level:
fuzzer-file-3200.c:7:3: error: size of variable ‘cma’ is too large
    7 | } cma[] = {{}, {}, {}, {}, {}, {}};

             reply	other threads:[~2022-04-11 20:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 20:28 k.even-mendoza at imperial dot ac.uk [this message]
2022-04-11 20:43 ` [Bug tree-optimization/105232] [11/12 Regression] ICE in tree_to_poly_int64 via check_builtin pinskia at gcc dot gnu.org
2022-04-12  7:51 ` marxin at gcc dot gnu.org
2022-04-12  7:54 ` rguenth at gcc dot gnu.org
2022-04-12  7:54 ` rguenth at gcc dot gnu.org
2022-04-12  8:54 ` cvs-commit at gcc dot gnu.org
2022-04-12  8:54 ` [Bug tree-optimization/105232] [11 " rguenth at gcc dot gnu.org
2022-04-12 10:49 ` cvs-commit at gcc dot gnu.org
2022-04-12 10:50 ` rguenth 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-105232-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).