I've come across the following whilst trying to build a gcc cross-compiler:
/warthog/frv/gcc/build/./gcc/xgcc -B/warthog/frv/gcc/build/./gcc/ -B/opt/frv-4.1/frv-linux-gnu/bin/ -B/opt/frv-4.1/frv-linux-gnu/lib/ -isystem /opt/frv-4.1/frv-linux-gnu/include -isystem /opt/frv-4.1/frv-linux-gnu/sys-include -O2 -O2 -g -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libdecnumber -I../libdecnumber -DL_divsc3 -fvisibility=hidden -DHIDE_EXPORTS -c ../../gcc/gcc/libgcc2.c -o libgcc/./_divsc3.o ../../gcc/gcc/libgcc2.c: In function ‘__divsc3’: ../../gcc/gcc/libgcc2.c:1910: internal compiler error: in default_secondary_reload, at targhooks.c:532 The compiler sources were pulled by Subversion from the gcc repository: Path: . URL: svn://gcc.gnu.org/svn/gcc/trunk Repository Root: svn://gcc.gnu.org/svn/gcc Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4 Revision: 115899 Node Kind: directory Schedule: normal Last Changed Author: schwab Last Changed Rev: 115899 Last Changed Date: 2006-08-03 10:28:37 +0100 (Thu, 03 Aug 2006) Properties Last Updated: 2006-08-01 21:01:27 +0100 (Tue, 01 Aug 2006) The binutils tools being used were: warthog>./as --version GNU assembler 2.14-frv-060512-1 20031112 And the tools necessary for the compiler can be obtained from: http://people.redhat.com/~dhowells/frv/as http://people.redhat.com/~dhowells/frv/ld http://people.redhat.com/~dhowells/frv/ar http://people.redhat.com/~dhowells/frv/ranlib http://people.redhat.com/~dhowells/frv/nm http://people.redhat.com/~dhowells/frv/objdump http://people.redhat.com/~dhowells/frv/strip Or in a huge tarball with lots of other stuff from: ftp://ftp.ges.redhat.com/private/releng/frv-060512-Fc6734/tools.tar.bz2 I've reproduced this problem compiling gcc on on an SMP i686 box and a UP x86_64 box. On both boxes the native compiler was installed from the gcc-4.1.1-1.fc5 Fedora Core 5 RPMs: warthog>gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux Thread model: posix gcc version 4.1.1 20060525 (Red Hat 4.1.1-1) warthog255>ssh hades gcc -v Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux Thread model: posix gcc version 4.1.1 20060525 (Red Hat 4.1.1-1) The partially built gcc claims its version to be: warthog>./gcc/xgcc -v Using built-in specs. Target: frv-linux-gnu Configured with: ../gcc/configure --target=frv-linux-gnu --prefix=/opt/frv-4.1 --enable-languages=c --with-build-time-tools=/opt/frv-4.1/frv-linux-gnu/bin/ --with-as=/opt/frv-4.1/frv-linux-gnu/bin/frv-linux-gnu-as Thread model: posix gcc version 4.2.0 20060803 (experimental) I configured the package with the configuration line you can see above and then just ran "make". The intermediate compiler can be used to trigger the bug with following command line: ./gcc/xgcc -B./gcc -O2 -c wibble.c -o wibble.o from within the build directory. wibble.c is the attached preprocessed and stripped down version of libgcc2.c. Note that adding: #define __builtin_expect(X, Y) (X) to the top of the file seems to make the problem go away. David -- Summary: ICE in default_secondary_reload, at targhooks.c:532 when building libgcc2.c as _divsc3.o Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dhowells at redhat dot com GCC build triplet: x86_64-unknown-linux-gnu, i686-pc-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu, i686-pc-linux-gnu GCC target triplet: frv-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28583