https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80974
Bug ID: 80974 Summary: wrong code (generated code hangs) at -O2 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: su at cs dot ucdavis.edu Target Milestone: --- It seems to be a recent regression. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 8.0.0 20170604 (experimental) [trunk revision 248860] (GCC) $ $ gcc-trunk -Os small.c; ./a.out $ gcc-6.2 -O2 small.c; ./a.out $ $ gcc-trunk -O2 small.c $ timeout -s 9 5 ./a.out Killed $ ----------------------------------------- int a, b, c, d, e, f, g[4]; static int fn1 () { int h, i; if (b) goto L1; L2:; int m = a; while (1) { int n = 2; e = !f && (n = 5); if (e) for (h = 0; h < 9; h++) for (i = 0; i < 6; i++) if (a) g[h] = 4; if (d) goto L2; a & n || b; L1: if (a) L3: c = m; if (a) goto L3; if (b < 5) return 0; } } int main () { fn1 (); return 0; }