https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102014
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- No, that is not a safe optimization. The x86 128-bit by 64-bit DIV instruction will #DE if the quotient is larger than ~(uint64_t) 0, you won't get a modulo in that case even when the modulo is guaranteed to be representable. Consider e.g. a == b == 0x3fffffffffffffffULL and n == 3.