https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115579
--- Comment #3 from Zhendong Su <zhendong.su at inf dot ethz.ch> --- Perhaps the same or a related issue. It reproduces for -O{s,2,3}. Compiler Explorer: https://godbolt.org/z/x779P9b5a [570] % 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 20240620 (experimental) (GCC) [571] % [571] % gcctk -O2 small.c; ./a.out [572] % [572] % gcctk -O2 -fno-tree-fre -fno-tree-sra -fno-tree-ch -fno-tree-dce small.c [573] % ./a.out Floating point exception [574] % [574] % cat small.c int a = 1; int main() { int b[1], c; for (c = 0; c < 2; c++) { int d = a, e = 1 / d; while (!e) { b[0] = 0; while (b[0]) ; a = 0; } } return 0; }