[Python-Dev] FYI: Python 2.7.1 + gcc 4.6 (experimental) probable optimizer problem

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Sat Jan 8 21:03:35 CET 2011

I just wanted to share an observation in case Python developers are
Python 2.7.1 doesn't build with the current gcc 4.6 svn.
Note that gcc 4.6 is now in "bug-fix only" mode.

Some details:

Fedora 14 64-bit.

The first time I noticed the problem was in Nov or early Dec 2010;
I'm pretty sure it worked in Oct maybe still early Nov.

Python configured simply with ./configure

g++ (GCC) 4.6.0 20101206 (experimental)
% make
/bin/sh: line 1: 41686 Segmentation fault      (core dumped) CC='gcc -pthread' 
LDSHARED='gcc -pthread -shared ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes' ./python -E ./setup.py build
make: *** [sharedmods] Error 139

g++ (GCC) 4.6.0 20110108 (experimental)
% make
XXX lineno: 743, opcode: 0
Traceback (most recent call last):
  File "/net/theta/raid1/rwgk/junk/Python-2.7.1/Lib/site.py", line 62, in 
    import os
  File "/net/theta/raid1/rwgk/junk/Python-2.7.1/Lib/os.py", line 743, in 
    def urandom(n):
SystemError: unknown opcode
make: *** [sharedmods] Error 1

make finishes OK if I configure --with-pydebug. Therefore my guess is that there 
is an optimizer bug in the current gcc 4.6 that's only triggered by a specific 
construct in Python. (A lot of other stuff builds and runs fine.)

BTW: I've been doing gcc pre-release testing regularly for many year, starting 
with gcc 3.3. This is the first time I see the Python build fail persistently 
for several weeks.

More information about the Python-Dev mailing list