Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 51222 - gcc-3.4.0-r{2,4} segfaults when compiling qemu on amd64
Summary: gcc-3.4.0-r{2,4} segfaults when compiling qemu on amd64
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: AMD64 Project
URL: http://gcc.gnu.org/bugzilla/show_bug....
Whiteboard:
Keywords:
Depends on:
Blocks: 48528
  Show dependency tree
 
Reported: 2004-05-16 11:19 UTC by Gabriel Ebner
Modified: 2004-08-25 16:29 UTC (History)
0 users

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


Attachments
op.c, which causes trouble when compiled with -O?. (op.c,155.44 KB, text/plain)
2004-05-16 11:21 UTC, Gabriel Ebner
Details
helper.c, another file which causes trouble when compiled with -O? (helper.c,90.47 KB, text/plain)
2004-05-20 04:37 UTC, Gabriel Ebner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriel Ebner 2004-05-16 11:19:21 UTC
When I try to compile current QEMU (current cvs) with sys-devel/gcc-3.4.0-r2 on amd64, gcc segfaults while compiling target-i386/op.c in i386-user.

I'm submitting the preprocessed source as requested by the message.  You can trigger the bug easily by running gcc -c op.c -O.

Reproducible: Always
Steps to Reproduce:
1. ./configure --target-list=i386-user
2. make

Actual Results:  
First an error telling me about the segfault than a message requesting me to 
submit a bug here. 

Expected Results:  
Successful compilation without a segfault. 

gebner@schnecke2 i386-user $ emerge info 
Portage 2.0.50-r6 (default-amd64-2004.0, gcc-3.4.0, 
glibc-2.3.3_pre20040420-r0, 2.6.6-mm2) 
================================================================= 
System uname: 2.6.6-mm2 x86_64 4 
Gentoo Base System version 1.4.12 
Autoconf: sys-devel/autoconf-2.59-r3 
Automake: sys-devel/automake-1.8.3 
ACCEPT_KEYWORDS="amd64 ~amd64" 
AUTOCLEAN="yes" 
CFLAGS="-O3 -pipe" 
CHOST="x86_64-pc-linux-gnu" 
COMPILER="gcc3" 
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /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 -pipe" 
DISTDIR="/usr/portage/distfiles" 
FEATURES="autoaddcvs ccache sandbox" 
GENTOO_MIRRORS="http://gentoo.inode.at/ 
    http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/" 
MAKEOPTS="-j2" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/var/tmp" 
PORTDIR="/usr/portage" 
PORTDIR_OVERLAY="/usr/local/portage" 
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage" 
USE="X X509 Xaw3d aac aalib accounting acl acpi ada alsa amd64 apache2 
ardour-ksi async athena audiofile avantgo avi berkdb bidi bluetooth bonobo cap 
caps cddb cdf cdr cgi cjk clisp cmucl crypt cscope cups dga dillo dnd dnsdb 
doc dv dvd dvdr encode escreen ethereal evo expat f77 faad fam fastcgi fax 
fbcon fbdev ffmpeg fftw flac foomaticdb fs gcl gd gdbm geoip gif gimpprint 
ginac glade glgd gmp gmtfull gmthigh gmtsuppl gmttria gnomedb gpm gps gsl 
gstreamer gtk gtk2 gtkhtml guile hbci hdf hdf5 idea idl ieee1394 imagemagick 
imlib ipcs ipv6 irda irmc jack jpeg kde kerberos ladcca lcd lcms leim lesstif 
libdsk libg libgda libsamplerate libwww linguas_de lirc lua mad maildir 
matroska mbox mcal md5sum mikmod mng monkey mono motif mozilla moznocompose 
moznoirc moznomail mpeg mpeg4 mule nas ncurses nls nptl nviz objc ocaml ofx 
oggvorbis openal opengl opie oskit-profiling pam pcmcia pcre pda pdflib perl 
php pic plotutils png pnp ppds pthreads python qhull qt quicktime radeon 
readline ruby samba scanner sdk sdl serial slang slp snmp sox speedo speex 
spell sqlite ssl stroke svg t1lib tcltk tetex theora threads tiff transcode 
transparent-proxy truetype type1 uml unicode usb v4l v4l2 wifi wmf wxwin 
wxwindows xml xml2 xosd xv xvid yaz zlib zvbi"
Comment 1 Gabriel Ebner 2004-05-16 11:21:57 UTC
Created attachment 31535 [details]
op.c, which causes trouble when compiled with -O?.

I tried every option where the gcc man page says that it's enabled with -O2. 
No luck.  Just -O? gave me a segfault, even just -O.
Comment 2 Robert Moss (RETIRED) gentoo-dev 2004-05-20 03:05:12 UTC
What about -O0 and -Os? I've had problems before with other packages which are solved by compiling with one of the above - I think there's a bug in a macro enabled by a -O option, not an optimization flag.
Comment 3 Gabriel Ebner 2004-05-20 04:24:32 UTC
Robert, you're right.  That doesn't happen when compiling -O0.  It (gcc segfaulting) happens only with -Os, -O, -O1, -O2, -O3, -O4, ...

However if I supply all the options gcc(1) states that are enables with -O3, then there's no segfault:

gcc -c op.c -fdefer-pop -fmerge-constants -fthread-jumps -floop-optimize -fif-conversion -fif-conversion2 -fdelayed-branch -fguess-branch-probability -fcprop-registers -fomit-frame-pointer -fforce-mem -foptimize-sibling-calls -fstrength-reduce -fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse -fgcse-lm -fgcse-sm -fgcse-las -fdelete-null-pointer-checks -fexpensive-optimizations -fregmove -fschedule-insns -fschedule-insns2 -fsched-interblock -fsched-spec -fcaller-saves -fpeephole2 -freorder-blocks -freorder-functions -fstrict-aliasing -funit-at-a-time -falign-functions -falign-jumps -falign-loops -falign-labels -fcrossjumping -finline-functions -fweb -frename-registers
Comment 4 Gabriel Ebner 2004-05-20 04:37:30 UTC
Created attachment 31755 [details]
helper.c, another file which causes trouble when compiled with -O?

helper.c shows exactly the same problem as op.c.  gcc doesn't segfault when
compiled with no optimizations, but it segfaults with -Os, -O1, -O2, -O3,
though it doesn't segfault when expanding the shortcuts manually with the
optimizations given in gcc(1).
Comment 5 Gabriel Ebner 2004-05-25 03:48:10 UTC
I've upgraded to gcc-3.4.0-r4 and it still segfaults.
Comment 6 Gabriel Ebner 2004-06-14 15:12:32 UTC
gcc-3.4.0-r6 is the same:

schnecke2 root # gcc -O1 -c helper.c 
In file included from /home/gebner/tmp/qemu/target-i386/helper.c:20:
/home/gebner/tmp/qemu/target-i386/exec.h:312: warning: conflicting types for built-in function 'lrintl'
/home/gebner/tmp/qemu/target-i386/helper.c: In function `get_seg_base':
/home/gebner/tmp/qemu/target-i386/helper.c:171: warning: cast to pointer from integer of different size
/home/gebner/tmp/qemu/target-i386/helper.c: In function `load_seg_vm':
/home/gebner/tmp/qemu/target-i386/helper.c:186: warning: cast to pointer from integer of different size
/home/gebner/tmp/qemu/target-i386/helper.c: In function `do_interrupt_real':
/home/gebner/tmp/qemu/target-i386/helper.c:820: warning: cast to pointer from integer of different size
/home/gebner/tmp/qemu/target-i386/helper.c:822: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into /tmp/ccNurZXB.out file, please attach this to your bugreport.
schnecke2 root # gcc -O1 -c op.c     
In file included from /home/gebner/tmp/qemu/target-i386/op.c:28:
/home/gebner/tmp/qemu/target-i386/exec.h:312: warning: conflicting types for built-in function 'lrintl'
/home/gebner/tmp/qemu/target-i386/op.c: In function `op_divw_AX_T0':
/home/gebner/tmp/qemu/target-i386/op.c:307: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into /tmp/cc47sTMp.out file, please attach this to your bugreport.
Comment 7 Travis Tilley (RETIRED) gentoo-dev 2004-07-14 07:54:46 UTC
this still happens with 3.4.1... have you reported this problem upstream to the gcc devs themselves?
Comment 8 Gabriel Ebner 2004-07-24 18:12:18 UTC
[Sorry for the delay; I was a few hundred kilometers away from my gentoo box on holiday with a debian x86 laptop.]

Your wish is my order: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16702
Comment 9 Jason Huebel (RETIRED) gentoo-dev 2004-08-25 16:29:26 UTC
Reported upstream.  See URL above.