https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126925
Bug ID: 126925
Summary: ICE at -O3 on x86_64-linux-gnu: Segmentation fault
during GIMPLE pass: ivopts
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: xintong.zhou1 at uwaterloo dot ca
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/GYzrbeYG1
Note:
- fail: trunk, 8 - 16
- work: 7 or earlier
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=/data/x27zhou/compiler-nightly/install/gcc/bin/gcc
COLLECT_LTO_WRAPPER=/data/x27zhou/compiler-nightly/install/gcc/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /data/x27zhou/compiler-nightly/src/gcc/configure CC='ccache
clang' CXX='ccache clang++' --enable-checking=yes --disable-bootstrap
--disable-multilib --enable-languages=c,c++
--prefix=/data/x27zhou/compiler-nightly/install/gcc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20260814 (experimental) (GCC)
$
$ gcc-trunk -O0 small.c
$ gcc-trunk -O3 small.c
during GIMPLE pass: ivopts
small.c: In function āeā:
small.c:8:6: internal compiler error: Segmentation fault
8 | void e(int d) {
| ^
0x25d575f internal_error(char const*, ...)
/data/x27zhou/compiler-nightly/src/gcc/gcc/diagnostic-global-context.cc:787
0x1079af9 crash_signal(int)
/data/x27zhou/compiler-nightly/src/gcc/gcc/toplev.cc:325
0x7f5bc656351f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x123259a create_new_iv(ivopts_data*, iv_cand*)
/data/x27zhou/compiler-nightly/src/gcc/gcc/tree-ssa-loop-ivopts.cc:7262
0x123259a create_new_ivs(ivopts_data*, iv_ca*)
/data/x27zhou/compiler-nightly/src/gcc/gcc/tree-ssa-loop-ivopts.cc:7305
0x123259a tree_ssa_iv_optimize_loop(ivopts_data*, loop*, bitmap_head*)
/data/x27zhou/compiler-nightly/src/gcc/gcc/tree-ssa-loop-ivopts.cc:8222
0x122e8bf tree_ssa_iv_optimize()
/data/x27zhou/compiler-nightly/src/gcc/gcc/tree-ssa-loop-ivopts.cc:8258
0x12723ad (anonymous namespace)::pass_iv_optimize::execute(function*)
/data/x27zhou/compiler-nightly/src/gcc/gcc/tree-ssa-loop.cc:464
/data/x27zhou/compiler-nightly/install/gcc/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -imultiarch x86_64-linux-gnu small.c -quiet -dumpdir a- -dumpbase
small.c -dumpbase-ext .c -mtune=generic -march=x86-64 -O3 -o /tmp/cceAb58l.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.
$
$ cat small.c
int a;
long b;
int c(long d) {
for (;;)
if (d)
return b;
}
void e(int d) {
unsigned long f = 6;
int g;
while (c(f)) {
g = 0;
for (; g < 2; g++) {
a = 0;
short h = d;
f = d + f - (h + f + (a + 4 + f));
}
}
}
int main() {}