public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111915] New: GCC: ICEs on a program with __restrict and option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp`
@ 2023-10-22  2:48 141242068 at smail dot nju.edu.cn
  2023-10-22  2:55 ` [Bug tree-optimization/111915] [14 Regression] ICE in vect with " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2023-10-22  2:48 UTC (permalink / raw)
  To: gcc-bugs

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.
```

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/111915] [14 Regression] ICE in vect with option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp`
  2023-10-22  2:48 [Bug c/111915] New: GCC: ICEs on a program with __restrict and option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp` 141242068 at smail dot nju.edu.cn
@ 2023-10-22  2:55 ` pinskia at gcc dot gnu.org
  2023-10-22  2:57 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22  2:55 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-10-22
   Target Milestone|---                         |14.0
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
           Keywords|                            |needs-bisection
            Summary|GCC: ICEs on a program with |[14 Regression] ICE in vect
                   |__restrict and option `-O2  |with option `-O2
                   |-fno-tree-vrp               |-fno-tree-vrp
                   |-fno-tree-dominator-opts    |-fno-tree-dominator-opts
                   |-fno-tree-ccp`              |-fno-tree-ccp`

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/111915] [14 Regression] ICE in vect with option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp`
  2023-10-22  2:48 [Bug c/111915] New: GCC: ICEs on a program with __restrict and option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp` 141242068 at smail dot nju.edu.cn
  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
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22  2:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Maybe one of richi's recent SLP related patches:

GCC 13:
/app/example.cpp:5:21: missed:   Build SLP failed: not grouped load _12 = *_11;
/app/example.cpp:5:21: note:   SLP discovery for node 0x4cdbb68 failed
/app/example.cpp:5:21: note:   SLP discovery for node 0x4cdbae8 failed
/app/example.cpp:5:21: note:   SLP discovery failed

But GCC 14:
/app/example.cpp:5:21: note:   Build SLP for _6 = *_5;
/app/example.cpp:5:21: note:   precomputed vectype: vector(4) int
/app/example.cpp:5:21: note:   nunits = 4
/app/example.cpp:5:21: note:   SLP discovery for node 0x4802428 succeeded

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/111915] [14 Regression] ICE in vect with option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp`
  2023-10-22  2:48 [Bug c/111915] New: GCC: ICEs on a program with __restrict and option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp` 141242068 at smail dot nju.edu.cn
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22  2:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the reasoning for the extra options is still get:

  _2 = i_26 * 2;

  _23 = _2 & 1;
  _9 = (long unsigned int) _23;

In the IR.

Otherwise _23 would be 0.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [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
  2023-10-22  2:48 [Bug c/111915] New: GCC: ICEs on a program with __restrict and option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp` 141242068 at smail dot nju.edu.cn
                   ` (2 preceding siblings ...)
  2023-10-22  2:59 ` pinskia at gcc dot gnu.org
@ 2023-10-22 22:05 ` sjames at gcc dot gnu.org
  2023-10-23  9:17 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-10-22 22:05 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[14 Regression] ICE in vect |[14 Regression] ICE in vect
                   |with option `-O2            |with option `-O2
                   |-fno-tree-vrp               |-fno-tree-vrp
                   |-fno-tree-dominator-opts    |-fno-tree-dominator-opts
                   |-fno-tree-ccp`              |-fno-tree-ccp` since
                   |                            |r14-2117-gdd86a5a69cbda4
                 CC|                            |rguenth at gcc dot gnu.org,
                   |                            |sjames at gcc dot gnu.org

--- Comment #4 from Sam James <sjames at gcc dot gnu.org> ---
dd86a5a69cbda40cf76388a65d3317c91cb2b501 is the first bad commit
commit dd86a5a69cbda40cf76388a65d3317c91cb2b501
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jun 22 11:40:46 2023 +0200

    tree-optimization/96208 - SLP of non-grouped loads

-> r14-2117-gdd86a5a69cbda4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [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
  2023-10-22  2:48 [Bug c/111915] New: GCC: ICEs on a program with __restrict and option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp` 141242068 at smail dot nju.edu.cn
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-23  9:17 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
I will have a look.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [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
  2023-10-22  2:48 [Bug c/111915] New: GCC: ICEs on a program with __restrict and option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp` 141242068 at smail dot nju.edu.cn
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-23 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:00eb0812e6464307f9f971d2a743d720015e70cf

commit r14-4865-g00eb0812e6464307f9f971d2a743d720015e70cf
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Oct 23 13:42:53 2023 +0200

    tree-optimization/111915 - mixing grouped and non-grouped accesses

    The change to allow SLP of non-grouped accesses failed to check
    for the case of mixing with grouped accesses.

            PR tree-optimization/111915
            * tree-vect-slp.cc (vect_build_slp_tree_1): Check all
            accesses are either grouped or not.

            * gcc.dg/vect/pr111915.c: New testcase.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [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
  2023-10-22  2:48 [Bug c/111915] New: GCC: ICEs on a program with __restrict and option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp` 141242068 at smail dot nju.edu.cn
                   ` (5 preceding siblings ...)
  2023-10-23 13:33 ` cvs-commit at gcc dot gnu.org
@ 2023-10-23 13:33 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-23 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-10-23 13:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-22  2:48 [Bug c/111915] New: GCC: ICEs on a program with __restrict and option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp` 141242068 at smail dot nju.edu.cn
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

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).