I would as well suggest fixing first the (INT64_MAX / -1) crash on HEAD and back-branches with something like the patch attached, inspired from int8.c.
I think it is overkill, but do as you feel.
Perhaps we could have Robert decide on this one first? That's a bug after all that had better be backpatched.
Note that it must also handle modulo, but the code you suggest cannot be used for that.
#include <stdint.h> int main(int argc, char* argv[]) { int64_t l = INT64_MIN; int64_t r = -1; int64_t d = l % r; return 0; } // => Floating point exception (core dumped)
Right, forgot this one, we just need to check if rval is -1 here, and return 0 as result. I am updating the fix as attached.