Paolo Bonzini wrote:
Jack Howarth wrote:
+       if (y == -1 && x < 0 && ((unsigned)x) == -(unsigned)x)
                return DIVMOD_OVERFLOW;

or just a much clearer

    if (y == -1 && x == INT_MIN)
        return DIVMOD_OVERFLOW;

(possibly with a #include <limits.h> at the top).
Nit picking -
"x" is of type long, so the fix should be either x==LONG_MIN or
(unsigned long)x == -(unsigned long)x.

This is completely off-topic on this list. I am sending this to the list
only to avoid having buggy code on the gcc-ml archives.

Michael

Reply via email to