https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113105
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- When it is signed v / a * b + v % a, I think it can introduce UB which wasn't there originally. E.g. for v = 0, a = INT_MIN and b = 3. So, if it isn't done just for unsigned types, parts of it need to be done in unsigned.