https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121468
Bug ID: 121468 Summary: compiler hang at -Os on x86_64-linux-gnu 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/5r3hc4Wb9 Note: - It is a recent regression as it doesn't reproduce with 15.1 and earlier. [587] % 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 20250807 (experimental) (GCC) [588] % [588] % timeout -s 9 10 gcctk -Os small.c Killed [589] % [589] % cat small.c int e, f, n; static int a () { return e; } void b () { while (a()); } static int d () { return e; } static void g (int h) { if (e) c: if (d()) goto i; do { if (f) goto c; goto k; i: h = 2147483647; k: e = 2147483646; e = 6 + e; do { b (); } while (1784828957 / f + e + (808 + h) > 0); } while (1 % h); } void m () { g (-2); } int main () { if (n) g (-1); }