https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100810
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- Btw, while in the abstract machine sense for the testcase 'i' is never actually read the SSA GIMPLE already exposes an uninitialized read of it: void k () { ... <bb 3> : a.9_3 = a; if (a.9_3 >= 0) goto <bb 5>; [INV] else goto <bb 15>; [INV] <bb 4> : i_25 = i_13 + 1; h.10_4 = h; _5 = h.10_4 + -1; h = _5; <bb 5> : # i_13 = PHI <i_20(D)(3), i_25(4)> a.11_6 = a; if (a.11_6 != 0) goto <bb 4>; [INV] else goto <bb 6>; [INV] that's because for while (a) { } which is not entered because 'a' is zero we have the PHI node for 'i' since the condition is part of the loop and SSA form requires us to represent the value of 'i' on the entry edge. That means those uses are not real uses and thus do not invoke undefined behavior (at the point of execution of the PHI node). That would be different from tem_2 = i_20(D); <bbN> # tem_3 = PHI <tem_2, ..> but copy propagation will turn this into the other case (but that would be conservatively OK). Note that for the testcase IVOPTs inserts the rewritten uses in a place where i is now used unconditionally turning if (a.9_15 >= 0) goto <bb 20>; [59.00%] else goto <bb 15>; [41.00%] <bb 20> [local count: 139545903]: goto <bb 8>; [100.00%] <bb 7> [local count: 564526613]: i_17 = i_16 + 1; _19 = h_lsm.23_10 + -1; <bb 8> [local count: 634299566]: # i_16 = PHI <i_24(D)(20), i_17(7)> # h_lsm.23_10 = PHI <b.7_13(20), _19(7)> if (a.9_15 != 0) goto <bb 7>; [89.00%] else goto <bb 29>; [11.00%] <bb 29> [local count: 69772953]: into if (a.9_15 >= 0) goto <bb 20>; [59.00%] else goto <bb 15>; [41.00%] <bb 20> [local count: 139545903]: goto <bb 8>; [100.00%] <bb 7> [local count: 564526613]: i_17 = i_16 + 1; <bb 8> [local count: 634299566]: # i_16 = PHI <i_24(D)(20), i_17(7)> _28 = (unsigned int) b.7_13; _41 = (unsigned int) i_24(D); _51 = _28 + _41; _22 = (unsigned int) i_16; _48 = -_22; _49 = _48 + _51; h_lsm.23_10 = (int) _49; if (a.9_15 != 0) goto <bb 7>; [89.00%] else goto <bb 29>; [11.00%] <bb 29> [local count: 69772953]: when it eliminates the h_lsm.23 IV and rewrites it in terms of i.