https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71466
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> --- The problem is caused by loop unroller: 144t.ivcanon looks good: fn1 () { _Bool c_lsm.12; int c_lsm.11; _Bool d_lsm.10; int d_lsm.9; int f; int e; int _5; int c.3_9; int _13; int c.3_21; <bb 2>: c = 0; goto <bb 4>; <bb 3>: # e_4 = PHI <e_20(4), 0(5)> # c.3_9 = PHI <c.3_21(4), _5(5)> <bb 4>: # e_35 = PHI <0(2), e_4(3)> # c.3_21 = PHI <0(2), c.3_9(3)> e_20 = e_35 + 1; if (e_20 != 2) goto <bb 3>; else goto <bb 5>; <bb 5>: _5 = c.3_21 + 1; if (_5 <= 1) goto <bb 3>; else goto <bb 6>; <bb 6>: # _13 = PHI <_5(5)> d = 0; c = _13; return; } While 152t.cunroll contains wrongly unrolled code: fn1 () { _Bool c_lsm.12; int c_lsm.11; _Bool d_lsm.10; int d_lsm.9; int f; int e; int _1; int _5; int c.3_9; int _10; int c.3_12; int _13; int c.3_16; <bb 2>: c = 0; e_36 = 1; if (e_36 != 2) goto <bb 4>; else goto <bb 3>; <bb 3>: _1 = 1; if (_1 <= 1) goto <bb 4>; else goto <bb 9>; <bb 4>: # e_25 = PHI <e_36(2), 0(3)> # c.3_16 = PHI <0(2), _1(3)> e_8 = e_25 + 1; /* here: e_8 == 2 */ if (e_8 != 2) goto <bb 6>; else goto <bb 5>; <bb 5>: _10 = c.3_16 + 1; if (_10 <= 1) goto <bb 6>; else goto <bb 9>; <bb 6>: # e_17 = PHI <e_8(4), 0(5)> # c.3_12 = PHI <c.3_16(4), _10(5)> e_20 = e_17 + 1; /* here: e_20 == 3 */ if (e_20 != 2) goto <bb 7>; else goto <bb 8>; <bb 7>: # e_4 = PHI <e_20(6), 0(8)> # c.3_9 = PHI <c.3_12(6), _5(8)> __builtin_unreachable (); <bb 8>: _5 = c.3_12 + 1; if (_5 <= 1) goto <bb 7>; else goto <bb 9>; <bb 9>: # _13 = PHI <_5(8), _1(3), _10(5)> d = 0; c = _13; return; } I've been bisecting to understand what has changed since gcc 6.