https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121619
Bug ID: 121619 Summary: wrong code at -O{s,2,3} with "-fno-gcse -fno-tree-ter -fno-guess-branch-probability -fno-forward-propagate" on x86_64-linux-gnu (the generated code hangs) 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's a recent regression as it doesn't fail with the latest Compiler Explorer build. [516] % gcctk -v Using built-in specs. COLLECT_GCC=gcctk COLLECT_LTO_WRAPPER=/local/home/suz/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 20250820 (experimental) (GCC) [517] % [517] % gcctk -O3 small.c; ./a.out [518] % [518] % gcctk -O3 -fno-gcse -fno-tree-ter -fno-guess-branch-probability -fno-forward-propagate small.c [519] % timeout -s 9 5 ./a.out Killed [520] % cat small.c int printf(const char *, ...); long a, c, d; char b; int main() { f : { short g = 100; int h = 1; while (1) { char i = 0; if (a) i = h = -b; short j = g; c = h ^ g; g = ~(-h / c + 1); if (b > 6) { a = g && -1; goto f; } if (j < 100) printf("%ld\n", d); if (g - 1) break; b = i; } int k = 2L % g; if (k) goto f; } return 0; }