FYI: Python 2.7.1 + gcc 4.6 (experimental) probable optimizer problem

I just wanted to share an observation in case Python developers are interested: 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 <module> import os File "/net/theta/raid1/rwgk/junk/Python-2.7.1/Lib/os.py", line 743, in <module> 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.

On Sat, 8 Jan 2011 12:03:35 -0800 (PST) "Ralf W. Grosse-Kunstleve" rwgk@yahoo.com wrote:
I just wanted to share an observation in case Python developers are interested: 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.
You should report a bug with the gcc developers. By the way, can you try to build Python 3.2 too?

Antoine Pitrou solipsis@pitrou.net wrote:
On Sat, 8 Jan 2011 12:03:35 -0800 (PST) "Ralf W. Grosse-Kunstleve" rwgk@yahoo.com wrote:
I just wanted to share an observation in case Python developers are interested: 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.
You should report a bug with the gcc developers. By the way, can you try to build Python 3.2 too?
I can reproduce this with release27-maint on Fedora-14/amd64/gcc-4.6. -fno-strict-aliasing is enabled.
py3k is fine. Hard to tell if it's a gcc bug or not. gcc-4.6 increased the ANSI compliance requirements yet again, exposing third party bugs like this one:
http://sourceware.org/ml/libc-alpha/2010-12/msg00009.html
There is an issue for this:
http://bugs.python.org/issue9880
Stefan Krah

On Sat, 8 Jan 2011 22:58:51 +0100 Stefan Krah stefan@bytereef.org wrote:
Antoine Pitrou solipsis@pitrou.net wrote:
On Sat, 8 Jan 2011 12:03:35 -0800 (PST) "Ralf W. Grosse-Kunstleve" rwgk@yahoo.com wrote:
I just wanted to share an observation in case Python developers are interested: 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.
You should report a bug with the gcc developers. By the way, can you try to build Python 3.2 too?
I can reproduce this with release27-maint on Fedora-14/amd64/gcc-4.6. -fno-strict-aliasing is enabled.
It might be interesting to have a buildbot with a bleeding edge toolchain. Although in this case nobody rushed to diagnose the three-month old issue anyway:
There is an issue for this:
Regards
Antoine.

Antoine Pitrou solipsis@pitrou.net wrote:
I can reproduce this with release27-maint on Fedora-14/amd64/gcc-4.6. -fno-strict-aliasing is enabled.
It might be interesting to have a buildbot with a bleeding edge toolchain. Although in this case nobody rushed to diagnose the three-month old issue anyway:
I narrowed the issue down to -ftree-vectorize, which is part of -O3. Searching briefly for 'ftree-vectorize + bug' makes me think that we should wait for the stable gcc-4.6.
Stefan Krah

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.
Wild guess: did configure detect that it needs to use -fno-strict-aliasing?
Regards, Martin

On Sat, Jan 8, 2011 at 12:03 PM, Ralf W. Grosse-Kunstleve rwgk@yahoo.comwrote:
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
Does that version of gcc emit any warnings during compilation?

Does that version of gcc emit any warnings during compilation?
Yes, there are a few:
http://cci.lbl.gov/~rwgk/tmp/gcc_trunk_168695_fc14_py271/
This is with:
g++ (GCC) 4.6.0 20110112 (experimental)
Ralf
participants (5)
-
"Martin v. Löwis"
-
Antoine Pitrou
-
Daniel Stutzbach
-
Ralf W. Grosse-Kunstleve
-
Stefan Krah