https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126988
Bug ID: 126988
Summary: ICE on valid code at -O{2,3} with
"-fno-vect-cost-model -fno-tree-sra" on
x86_64-linux-gnu: in check_loop_closed_ssa_def, at
tree-ssa-loop-manip.cc:664
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zhendong.su at inf dot ethz.ch
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/bxq78c5be
Note:
- fails: trunk
- works: 16.2 and earlier
[641] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++,lto --disable-werror
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20260820 (experimental) [master r17-1628-gd1c12591336] (GCC)
[642] %
[642] % gcctk -O2 -c -fno-vect-cost-model -fno-tree-sra small.c
during GIMPLE pass: slp
small.c: In function āuā:
small.c:16:6: internal compiler error: in check_loop_closed_ssa_def, at
tree-ssa-loop-manip.cc:664
16 | void u() {
| ^
0x28040bb internal_error(char const*, ...)
../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0xa31bd3 fancy_abort(char const*, int, char const*)
../../gcc-trunk/gcc/diagnostics/context.cc:1813
0x8f9e02 check_loop_closed_ssa_def
../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:664
0x13c4807 check_loop_closed_ssa_bb
../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:689
0x13c4c96 verify_loop_closed_ssa(bool, loop*)
../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:714
0x13c4c96 verify_loop_closed_ssa(bool, loop*)
../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:698
0x10c9ca9 execute_function_todo
../../gcc-trunk/gcc/passes.cc:2118
0x10ca3ae execute_todo
../../gcc-trunk/gcc/passes.cc:2152
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -I /usr/local/include -I /local/suz-local/software/local/include
-imultiarch x86_64-linux-gnu -iprefix
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../lib/gcc/x86_64-pc-linux-gnu/17.0.0/
small.c -quiet -dumpbase small.c -dumpbase-ext .c -mtune=generic -march=x86-64
-O2 -fvect-cost-model=unlimited -fno-tree-sra -o /tmp/ccqqnGwq.s
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.
[643] %
[643] % cat small.c
extern void t(int);
typedef struct {
char a;
char b;
char c;
char d;
char e;
char f;
char g;
char h;
} i;
char j, k, l, n;
short m, p, r;
float o;
int q, s;
void u() {
i v, a;
ab:
n = q ? 0 : 3;
if (l)
goto ac;
a.a = a.b = a.c = -v.c;
a.d = -v.d;
ad:
v.a = v.b = v.c = a.c;
v.d = a.d;
v.e++;
v.f = v.g = v.h = a.h + 1;
while (j)
;
if (s)
goto ab;
a.e = 0;
if (m)
goto ad;
ac:
p = o ?: 5;
if (l) {
v.a = a.a - 1;
v.b = a.b - 1;
v.c = a.c - 1;
v.d = a.d - 1;
v.e = a.e - 1;
v.g = v.h = (a.h - 1) & (p - (unsigned)k) >> k;
}
a.a = v.a - 1;
a.b = v.b - 1;
a.c = v.c + v.c - 1;
a.d = v.d + v.d - 1;
a.e = v.e + v.e - 1;
r = n ? 0 : v.f >> v.g;
t(v.h);
t((long)a.a >> a.b);
t((long)a.c >> a.d);
t((long)a.e >> 56);
}