https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107493
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- a_lsm.9_12 = PHI <-21(2), _4(3)> (set_scalar_evolution instantiated_below = 2 (scalar = a_lsm.9_12) (scalar_evolution = (int) {65515, +, 10}_1)) is definitely wrong since the initial value is off. The evolution after that looks OK though, so not sure why SCCP gets the wrong final value here, we compute the number of iterations to zero (also wrong). It goes wrong when we get to the truncation, we then do *evolution_of_loop = chrec_convert (type, *evolution_of_loop, at_stmt); with {-21, + 2}_1 converting that to unsigned short. This ends up in convert_affine_scev but that assumes it converts the cycle and not that the conversion is inside the cycle. The old sanity checking of the initial value would have catched this but the actual error is elsewhere. The question is what's valid here. I'm going to try restricting this all further.