[Python-Dev] Before 2.5 - More signed integer overflows

"Martin v. Löwis" martin at v.loewis.de
Mon Sep 18 08:26:07 CEST 2006

> BTW, did anyone try compiling Python with -fwrapv on a box where it
> matters?  I doubt that Python's speed is affected one way or the
> other, and if adding wrapv makes the problems go away, that would be
> an easy last-second workaround for all possible such problems (which
> of course could get fixed "for real" for 2.5.1, provided someone cares
> enough to dig into it).

It's not so easy to add this option: configure needs to be taught to
check whether the option is supported first; to test it, you ideally
need an installation where it is supported, and one where it isn't.

I've added a note to README indicating that GCC 4.2 shouldn't be
used to compile Python. I don't consider this a terrible limitation,
especially since GCC 4.2 isn't released, yet.

OTOH, I get the same problem that Armin gets (abs(-sys.maxint-1)
is negative) also on a 32-bit system, with Debian's gcc 4.1.2
(which also isn't released, yet), so it appears that the problem
is already with gcc 4.1.

On my system, adding -fwrapv indeed solves the problem
(tested for abs()). So I added this to the README also.


More information about the Python-Dev mailing list