https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123061
--- Comment #1 from Zhendong Su <zhendong.su at inf dot ethz.ch> --- Another very likely related reproducer that only fails at -O1. Compiler Explorer: https://godbolt.org/z/YTWhM7Gnn Note: - fails: 12.1 and later - works: 11.4 and earlier [591] % 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 20251209 (experimental) (GCC) [592] % [592] % gcctk -O1 small.c; ./a.out [593] % [593] % gcctk -O1 -ffinite-loops small.c [594] % ./a.out Floating point exception [595] % [595] % cat small.c int a, b, c; int d() { while (a) ; return 0; } static int e(int f, int g) { c = f; while (1) { f = 0; do { c = -c; if (c >= 0) goto h; } while (-1 / b); return d(); h: b = g; } } int main() { while (e(-4, 3)) ; return 0; }
