https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99101
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> --- The following reduced testcase fails in the described way at -O2 with the C++ FE and with the C FE if you specify -ffinite-loops in addition to -O2. Already CDDCE1 does the problematic transform which means the first breakpoint hit on perform_tree_ssa_dce is the problematic one easing further investigation. volatile int xx; int main() { int read_finish_ = 1; int jobs_ = 1; int at_eof_ = 0; while (1) { int num_job = jobs_; for (int i = 0; i < jobs_; i++) { if (at_eof_) continue; if (read_finish_) { at_eof_ = 1; __builtin_printf ("1\n"); if (xx) __builtin_abort (); } } jobs_ -= num_job; } return 0; }