From the Python README: GCC 4.1, GCC 4.2: There is a known incompatibility between Python and GCC, where GCC 4.1 and later uses an interpretation of C different to earlier GCC releases in an area where the C specification has undefined behaviour (namely, integer arithmetic involving -sys.maxint-1). As a consequence, compiling Python with GCC 4.1/4.2 is not recommended. It is likely that this problem will be resolved in future Python releases. As a work-around, it seems that adding -fwrapv to the compiler options restores the earlier GCC behaviour. I can approve this. From the python interpreter: >>> abs(-sys.maxint-1) -2147483648 Of course, this shouldn't be a negative value. Compiled with -fwrapv, it works: >>> abs(-sys.maxint-1) 2147483648L Perhaps, someone should fix this in the ebuilds.
emerge --info? version of python you ran that test with? It works here (get 2147483648L) with python 2.5-r1 and python 2.4.3-r3 compiled with gcc 4.1.1 on an athlon-xp with CFLAGS="-ggdb -O2 -march=athlon-xp -pipe". I do see it mentioned in the README for python 2.5, but there is no bug number there and I can't find it in sf with a quick search. Do you have a sourceforge bug number for this?
I found a thread about it on the python-dev mailing list (http://mail.python.org/pipermail/python-dev/2006-August/068481.html). The thread starter also opened a Sourceforge bug (#1545668). I have the error with both python 2.4.3-r1 and 2.5-r1. emerge --info: Portage 2.1.1 (default-linux/x86/2006.1, gcc-4.1.1, glibc-2.4-r3, 2.6.14-gentoo-r4 i686) ================================================================= System uname: 2.6.14-gentoo-r4 i686 Intel(R) Pentium(R) 4 CPU 3.40GHz Gentoo Base System version 1.12.4 Last Sync: Wed, 20 Sep 2006 14:00:01 +0000 app-admin/eselect-compiler: [Not Present] dev-java/java-config: 1.3.0-r2, 2.0.27-r1 dev-lang/python: 2.3.5-r2, 2.4.3-r1, 2.5-r1 dev-python/pycrypto: 2.0.1-r5 dev-util/ccache: [Not Present] dev-util/confcache: [Not Present] sys-apps/sandbox: 1.2.17 sys-devel/autoconf: 2.13, 2.59-r7 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2 sys-devel/binutils: 2.16.1-r3 sys-devel/gcc-config: 1.3.13-r3 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.11-r2 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-O3 -march=pentium4 -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib/mozilla/defaults/pref /usr/share/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/" CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo" CXXFLAGS="-O3 -march=pentium4 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict" GENTOO_MIRRORS="http://pandemonium.tiscali.de/pub/gentoo/ ftp://pandemonium.tiscali.de/pub/gentoo/ ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/" LANG="en_US.utf8" LC_ALL="en_US.utf8" LINGUAS="" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="x86 aac apache2 bash-completion berkdb bitmap-fonts cairo cli crypt cups dlloader dri dvb dvd dvdr dvdread elibc_glibc fbcon firefox gdbm glitz gpm gtk2 input_devices_keyboard input_devices_mouse ipod ipv6 java jpeg kdeenablefinal kernel_linux libg++ mysql ncurses nptl nptlonly nsplugin nvidia pam pcre png ppds pppd python readline reflection session spl sqlite ssl svg tcpd tiff truetype-fonts type1-fonts udev unicode userland_GNU utf8 video_cards_fbdev video_cards_nvidia video_cards_vesa win32codecs xorg xvid zlib" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, MAKEOPTS, PORTAGE_RSYNC_EXTRA_OPTS
*** This bug has been marked as a duplicate of bug 151246 ***