public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "141242068 at smail dot nju.edu.cn" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/111915] New: GCC: ICEs on a program with __restrict and option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp`
Date: Sun, 22 Oct 2023 02:48:29 +0000	[thread overview]
Message-ID: <bug-111915-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 111915
           Summary: GCC: ICEs on a program with __restrict and option `-O2
                    -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp`
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 141242068 at smail dot nju.edu.cn
  Target Milestone: ---

When compile this program, GCC crashes:
```
void 
foo (int * __restrict a, int * __restrict b, int * __restrict w)
{
  for (int i = 0; i < 16; ++i)
    {
      *a += w[2*i+0];
      *b += w[2*i&1];
    }
}

int main()
{
  int w[32];
  int a = 0, b = 0;
  foo (&a, b, w);
  return 0;
}
```

Compiler Explorer: https://gcc.godbolt.org/z/8oYjE3e9j

The crash seems to be triggered solely under specific conditions: when the
-fno-tree-vrp, -fno-tree-dominator-opts, and -fno-tree-ccp options are enabled,
in conjunction with an optimization level of -O2 or higher. However, I'm
uncertain whether this combination of settings violates on any internal
conventions or requirements tied to these options.

The full stack dump:
```
<source>: In function 'main':
<source>:15:12: warning: passing argument 2 of 'foo' makes pointer from integer
without a cast [-Wint-conversion]
   15 |   foo (&a, b, w);
      |            ^
      |            |
      |            int
<source>:2:43: note: expected 'int * restrict' but argument is of type 'int'
    2 | foo (int * __restrict a, int * __restrict b, int * __restrict w)
      |                          ~~~~~~~~~~~~~~~~~^
<source>: In function 'foo':
<source>:2:1: error: definition in block 3 follows the use
    2 | foo (int * __restrict a, int * __restrict b, int * __restrict w)
      | ^~~
for SSA_NAME: _12 in statement:
vect_cst__35 = {_12, _12, _12, _12};
during GIMPLE pass: vect
<source>:2:1: internal compiler error: verify_ssa failed
0x231f49e internal_error(char const*, ...)
        ???:0
0x139c15e verify_ssa(bool, bool)
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
```

             reply	other threads:[~2023-10-22  2:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-22  2:48 141242068 at smail dot nju.edu.cn [this message]
2023-10-22  2:55 ` [Bug tree-optimization/111915] [14 Regression] ICE in vect with " pinskia at gcc dot gnu.org
2023-10-22  2:57 ` pinskia at gcc dot gnu.org
2023-10-22  2:59 ` pinskia at gcc dot gnu.org
2023-10-22 22:05 ` [Bug tree-optimization/111915] [14 Regression] ICE in vect with option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp` since r14-2117-gdd86a5a69cbda4 sjames at gcc dot gnu.org
2023-10-23  9:17 ` rguenth at gcc dot gnu.org
2023-10-23 13:33 ` cvs-commit at gcc dot gnu.org
2023-10-23 13:33 ` 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-111915-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).