https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122898
Bug ID: 122898
Summary: ICE on valid code at -O{s,2,3} with
"-fno-tree-forwprop -fno-tree-fre" on
x86_64-linux-gnu: Segmentation fault
Product: gcc
Version: unknown
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/b1Gr6n1vG
Note:
- fails: trunk
- works: 15.2 and earlier
[516] % 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/16.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++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20251127 (experimental) (GCC)
[517] %
[517] % gcctk -O3 -c -fno-tree-forwprop -fno-tree-fre small.c
gcctk: internal compiler error: Segmentation fault signal terminated program
cc1
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
[518] %
[518] % cat small.c
extern void o();
int a, b, c, d, e, f, g, h, i, k, l, m, n;
volatile int j;
static void p() {
if (d) {
q:
if (a) {
if (k) {
if (!(d && e))
goto r;
if (i)
goto q;
o();
}
h || j;
}
s:
d || j;
if (a)
goto q;
r:
if (b) {
if (c)
goto t;
if (b)
goto r;
if (m)
goto q;
}
while (j)
;
u:
if (g) {
o();
goto s;
}
if (h) {
t:
if (n)
goto v;
o();
goto r;
}
int w = i & 1;
v:
if (w <= l)
if (f)
goto u;
goto q;
}
if (a)
goto v;
}
int main() { p(); }