This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc trunk vs python


Jack Howarth wrote:
Andrew,
    Thanks. The change...

--- Python-2.4.3/Objects/intobject.c.org        2006-08-23 23:49:33.000000000 -0400
+++ Python-2.4.3/Objects/intobject.c    2006-08-23 23:52:01.000000000 -0400
@@ -479,7 +479,7 @@
                return DIVMOD_ERROR;
        }
        /* (-sys.maxint-1)/-1 is the only overflow case. */
-       if (y == -1 && x < 0 && x == -x)
+       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).

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]