https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110666
--- Comment #5 from Zhendong Su <zhendong.su at inf dot ethz.ch> --- A couple of very likely related tests (especially #2 and #3): *** (1) wrong code at -O2, -O3, and -Os [539] % gcctk -O1 small.c; ./a.out [540] % gcctk -O2 small.c [541] % timeout -s 9 5 ./a.out Killed [542] % cat small.c int a, b = -1, c, d = -1; int main() { if (a) goto L2; L1: a = 0; L2: b && c; c = ~c * (d ^ (0 || a) || d & b); if (c) goto L1; return 0; } *** (2) wrong code at -O1 and above [558] % gcctk -O0 small.c; ./a.out [559] % gcctk -O1 small.c [560] % ./a.out Floating point exception [561] % cat small.c int a = 1, b, c; void f(int d) { for (; c < 2; c++) { if (!a) b = -1; a = (d != 4) == d; b = 1 % ~b; } } int main() { f(1 || b); } *** (3) wrong code at -O1 and above [577] % gcctk -O0 small.c; ./a.out [578] % gcctk -O1 small.c [579] % timeout -s 9 5 ./a.out Killed [580] % cat small.c int a = 1, b, c, d; void e(int f) { for (; c < 2; c++) { if (b) d = c; c = d; b = f; } } int main() { e(((a != 2) != a) != 1); }