Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 90270 - [4.0/wrong-code] python-2.4 fails with -O3
Summary: [4.0/wrong-code] python-2.4 fails with -O3
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard: 4.0.3
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-24 11:32 UTC by Brant Gurganus
Modified: 2006-01-15 21:46 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brant Gurganus 2005-04-24 11:32:03 UTC
When building python-2.4, it will consistently crash or segfault at a particular location with a particular combination of CFLAGS.

Reproducible: Always
Steps to Reproduce:
1. Set CFLAGS to CFLAGS="-O3 -fomit-frame-pointer -ftracer -fweb".
2. Emerge python-2.4-r3.
Actual Results:  
i686-pc-linux-gnu-gcc -pthread -Wl,-O1 -Wl,--sort-common -Wl,--enable-new-dtags
-Xlinker -export-dynamic -o python \
                Modules/python.o \
                -L. -lpython2.4 -lpthread -ldl  -lutil -L/usr/lib -lz   -lm
case $MAKEFLAGS in \
*-s*) LD_LIBRARY_PATH=/var/tmp/portage/python-2.4-r3/work/Python-2.4:
CC='i686-pc-linux-gnu-gcc -pthread' LDSHARED='i686-pc-linux-gnu-gcc -pthread
-shared' OPT='-DNDEBUG -O3 -fomit-frame-pointer -ftracer -fweb' ./python -E
./setup.py -q build;; \
*) LD_LIBRARY_PATH=/var/tmp/portage/python-2.4-r3/work/Python-2.4:
CC='i686-pc-linux-gnu-gcc -pthread' LDSHARED='i686-pc-linux-gnu-gcc -pthread
-shared' OPT='-DNDEBUG -O3 -fomit-frame-pointer -ftracer -fweb' ./python -E
./setup.py build;; \esac
/bin/sh: line 1: 24353 Segmentation fault     
LD_LIBRARY_PATH=/var/tmp/portage/python-2.4-r3/work/Python-2.4:
CC='i686-pc-linux-gnu-gcc -pthread' LDSHARED='i686-pc-linux-gnu-gcc -pthread
-shared' OPT='-DNDEBUG -O3 -fomit-frame-pointer -ftracer -fweb' ./python -E
./setup.py build
make: *** [sharedmods] Error 139


Expected Results:  
The build should complete.

I couldn't reproduce the issue removing any CFLAGS or reducing baselevel
optimization level.  I could tell that -fweb is definitely related though.

Portage 2.0.51.20-r4 (default-linux/x86/2005.0, gcc-4.0.0,
glibc-2.3.5.20050421-r0, 2.6.12-rc2-nitro1 i686)
=================================================================
System uname: 2.6.12-rc2-nitro1 i686 Mobile Intel(R) Pentium(R) 4 - M CPU 2.20GHz
Gentoo Base System version 1.6.11
ccache version 2.4 [disabled]
dev-lang/python:     2.4-r3
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5
sys-devel/binutils:  2.15.97
sys-devel/libtool:   1.5.14
virtual/os-headers:  2.6.11
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O3 -march=pentium4m -mtune=pentium4m -mfpmath=sse -mmmx -msse -msse2
-fomit-frame-pointer -fprefetch-loop-arrays -ftracer -pipe
-maccumulate-outgoing-args -ffast-math -fweb -funit-at-a-time"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CTARGET="i686-pc-linux-gnu"
CXXFLAGS="-O3 -march=pentium4m -mtune=pentium4m -mfpmath=sse -mmmx -msse -msse2
-fomit-frame-pointer -fprefetch-loop-arrays -ftracer -pipe
-maccumulate-outgoing-args -ffast-math -fweb -funit-at-a-time"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="ftp://gentoo.cs.rose-hulman.edu/linux/gentoo"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--enable-new-dtags"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://gentoo.cs.rose-hulman.edu/gentoo-portage"
USE="x86 X a52 aac acpi alsa avi bash-completion berkdb bitmap-fonts caps cdr
crypt cups curl dga dvd emboss encode esd fam flac foomaticdb freetype gd gdbm
gif gnome gnutls gpm gstreamer gtk gtk2 gtkhtml hal howl imagemagick imlib java
javascript jpeg junit kerberos lcms ldap libg++ libwww mad mikmod mmap mmx mng
mono motif mozilla mp3 mpeg mysql ncurses nls nptl offensive ogg oggvorbis
opengl pam pcmcia pcre pdflib perl pic png pnp ppds python quicktime readline
samba sdl sndfile spell sse ssl svg symlink tcpd theora threads tiff truetype
truetype-fonts type1-fonts unicode vcd vorbis wmf xml xml2 xmms xprint xv zlib"
Unset:  ASFLAGS, LANG, LC_ALL, LINGUAS
Comment 1 Rob Cakebread (RETIRED) gentoo-dev 2005-04-24 12:55:38 UTC
What do you mean by "reducing baselevel optimization level"? You recompiled your entire system with sane CFLAGS? 

Does python work with sane CFLAGS i.e. test it with just -O2?
Comment 2 Brant Gurganus 2005-04-24 13:47:00 UTC
I meant that -O2, -O1, and -O0 or removing any of the other mentioned CFLAGS lets Python compile without problems.  The problems only manifests itself with that combination of CFLAGS as far as I can tell.

I tweaked the summary to better indicate that the problem occurs during build, not at runtime (since the build never completes).
Comment 3 Alastair Tse (RETIRED) gentoo-dev 2005-04-24 15:49:48 UTC
that's a gcc4 bug, not python. 
Comment 4 Torsten Kaiser 2005-07-10 01:46:29 UTC
I hit the same bug, it is still present in gcc-4.0.1 but it does not depend on
-fweb.

My emerge --info:
Portage 2.0.51.19 (default-linux/x86/2005.0, gcc-4.0.1, glibc-2.3.5.20050421-r0,
2.6.12-gentoo-r4 i686)
=================================================================
System uname: 2.6.12-gentoo-r4 i686 Intel(R) Celeron(TM) CPU                1300MHz
Gentoo Base System version 1.6.12
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, Jul 10 2005, 10:37:41)]
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.3 [enabled]
dev-lang/python:     2.3.5
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.8.5-r3, 1.6.3, 1.9.5, 1.7.9-r1
sys-devel/binutils:  2.15.92.0.2-r10, 2.16.1
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=pentium3 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env
/usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /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/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentium3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig buildpkg ccache distlocks fixpackages sandbox
sfperms strict"
GENTOO_MIRRORS="[removed]"
MAKEOPTS="-j4"
PKGDIR="/var/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/root/ebuilds"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X acl acpi alsa apm arts avi berkdb bitmap-fonts cdr crypt cups curl
doc dvd dvdr emacs emboss encode esd ethereal fam ffmpeg flac font-server
foomaticdb fortran gcj gd gdbm gif gpm gtk gtk2 ieee1394 imagemagick imlib ipv6
ithreads java jpeg junit kde libg++ libwww mad mbox mikmod motif mozcalendar
mozdevelop mozilla mozsvg mozxmlterm mp3 mpeg mysql nas ncurses nls nptl ogg
oggvorbis opengl oss pam pda pdflib perl png python qt quicktime readline ruby
samba scanner sdl session slang spell ssl svg svga tcltk tcpd tetex theora tiff
truetype truetype-fonts type1-fonts usb vorbis xinerama xml xml2 xmms xv zlib
userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS


Recompiling glibc with gcc-4.0.1 did not help, but changing -O3 to -O2 worked.

Is there a bug in http://gcc.gnu.org/bugzilla/ related to this crash?
Comment 5 Mark Loeser (RETIRED) gentoo-dev 2006-01-15 21:46:55 UTC
This looks like its fixed on the gcc-4.0 branch, therefore will be fixed for gcc-4.0.3 which should be out in a couple weeks.  I don't think backporting the patch will be worth it given that fact.

Reopen the bug if anyone feels differently.