[Bug tree-optimization/113105] Missing optimzation: fold `div(v, a) * b + rem(v, a)` to `div(v, a) * (b - a) + v`
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 21 16:09:59 GMT 2023
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.
More information about the Gcc-bugs
mailing list