https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127670
Bug ID: 127670
Summary: GCC ICE in `vect_transform_stmt` on a valid SLP
vectorization input
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bic60176 at gmail dot com
Target Milestone: ---
Summary
GCC's `-O2` compilation of the valid C translation unit below terminates with
an internal compiler error in `vect_transform_stmt` during the GIMPLE SLP pass.
The reproducer is a small mutation of a GCC vectorizer test and does not
require execution to trigger the failure.
```c
int x[4];
int j[4];
void
foo (void)
{
x[0] = (x[0] << j[0]) + j[0];
x[1] = (x[0] << j[0]) + j[1];
x[2] = (x[2] << j[0]) + j[2];
x[3] = (x[3] << j[0]) + j[3];
}
```
This is a well-formed translation unit with global arrays that are
zero-initialized. The compiler failure occurs during compilation, before the
program runs. A valid input must not make the optimizer abort with an internal
compiler error.
The input is a one-token mutation of `gcc.dg/vect/bb-slp-pr95866.c`: the second
assignment reads `x[0]` where the test reads `x[1]`. The changed read is legal
C and does not introduce undefined behavior.