https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66248
Steve Ellcey <sje at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |sje at gcc dot gnu.org Resolution|--- |INVALID --- Comment #1 from Steve Ellcey <sje at gcc dot gnu.org> --- The truncate can not be moved out of the loop because that would affect the overflow behaviour of ret. I.e. we need to truncate ret on each iteration of the loop because doing the truncation may affect the value of ret used in the addition during the next iteration of the loop. This is not the same as doing one truncation at the end in cases where ret overflows the maximum value of a short type.