https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117859
Bug ID: 117859
Summary: ICE on valid code at -O{2,3} with "-fno-ssa-phiopt
-fno-expensive-optimization": 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: ---
It appears to be a recent regression as it doesn't reproduce with 14.2 and
earlier.
Compiler Explorer: https://godbolt.org/z/rz7fehsbW
[679] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/15.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 15.0.0 20241129 (experimental) (GCC)
[680] %
[680] % gcctk -O2 -fno-ssa-phiopt -fno-expensive-optimizations 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.
[681] %
[681] % cat small.c
unsigned char a;
int b, c, d, e, g, h, j, k;
struct {
int f : 1;
} i;
char l(int m) { return a > 255 >> m ? 0 : m; }
int main() {
if (i.f)
d = b;
k = e = 1;
for (; e; e--)
g = 0;
h = g ? 1 << g : 1;
c = h || i.f;
while (b)
j = l(k && i.f);
return 0;
}