Bug 57625

Summary: internal compiler error: seg fault when building gcc 4.7.2
Product: gcc Reporter: je.suis.bon
Component: middle-endAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: mikpelinux
Priority: P3    
Version: 4.7.2   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:
Attachments: libgcc2.c

Description je.suis.bon 2013-06-15 16:47:53 UTC
Created attachment 30308 [details]
libgcc2.c

I was attempting to build gcc 4.7.2 using gcc 4.8.1.

to reproduce:
mkdir build-gcc
cd build-gcc
../gcc-4.7.2/configure --disable-nls --enable-languages=c
echo "MAKEINFO = :" >> Makefile # otherwise compile fails!
make all-gcc
make all-target-libgcc

The following error occurs:
../../../../originalsrc/gcc-4.7.2/libgcc/libgcc2.c: In function '__absvdi2':
../../../../originalsrc/gcc-4.7.2/libgcc/libgcc2.c:273:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[3]: *** [_absvdi2.o] Error 1


In compliance with gcc's dying wishes, I have submitted a bug report. Although I'm sure you already have it, for rapid perusal, I have attached the source file that caused the seg fault.

extra information:
$gcc --version: gcc (GCC) 4.8.1
system: archlinux amd64, using the gcc package "gcc-4.8.1-1"

If any further information is required, please ask.
Comment 1 Mikael Pettersson 2013-06-15 20:20:43 UTC
I can't reproduce with FSF gcc 4.8.1 and 4.7.2 on Fedora 17 x86_64.  Your archlinux system compiler is presumably somewhat modified; can you try again with an FSF 4.8.1?  Also please make sure the 4.7.2 you're building is unmodified.
Comment 2 Anton Arapov 2013-11-05 23:19:06 UTC
build-cross/gcc-4.7.2/libgcc/libgcc2.c:111:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[3]: *** [_addvdi3.o] Error 1
make[3]: *** Waiting for unfinished jobs....


I've got this on Fedora 20:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-isl=/builddir/build/BUILD/gcc-4.8.2-20131017/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20131017/obj-x86_64-redhat-linux/cloog-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20131017 (Red Hat 4.8.2-1) (GCC)
Comment 3 Jonathan Wakely 2014-05-21 12:33:27 UTC
I can reproduce this with Fedora 20's system compiler:

gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC) 

Only when configured with --disable-bootstrap:

../gcc-4.7.2/configure --disable-bootstrap --enable-languages=c,c++ MAKEINFO=missing


/home/jwakely/tmp/b/build/./gcc/xgcc -B/home/jwakely/tmp/b/build/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -g -O2 -m32 -O2  -g -O2 -DIN_GCC   -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -fpic -I. -I. -I../../.././gcc -I../../../../gcc-4.7.2/libgcc -I../../../../gcc-4.7.2/libgcc/. -I../../../../gcc-4.7.2/libgcc/../gcc -I../../../../gcc-4.7.2/libgcc/../include -I../../../../gcc-4.7.2/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS  -DUSE_TLS -o _absvdi2.o -MT _absvdi2.o -MD -MP -MF _absvdi2.dep -DL_absvdi2 -c ../../../../gcc-4.7.2/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
../../../../gcc-4.7.2/libgcc/libgcc2.c: In function ‘__absvdi2’:
../../../../gcc-4.7.2/libgcc/libgcc2.c:273:1: internal compiler error: Segmentation fault


However it doesn't happen with 4.7.3 using the same configuration and same host compiler.
Comment 4 Mikael Pettersson 2014-05-21 21:52:40 UTC
I can reproduce on x86_64-linux (Fedora 18) with gcc-4.8.1, gcc-4.8-20140515, and gcc-4.9-20140514 as host compilers, and gcc-4.7.2 as the target compiler.
Comment 5 Mikael Pettersson 2014-05-24 19:28:40 UTC
The failure of gcc-4.8.0 and later to build gcc-4.7.2 w/ --disable-bootstrap started with r186592.  I'm getting loads of errors from glibc stating that malloc detects memory corruption in cc1.
Comment 6 Mikael Pettersson 2014-05-25 10:29:56 UTC
The failure of 4.7 being built w/ --disable-bootstrap by 4.8+ stopped with the PR54638 fix in r191605.  It's clear that the problem was undefined behaviour in 4.7.2, not a wrong-code error in 4.8+.
Comment 7 Marek Polacek 2015-09-21 13:38:16 UTC
Looks resolved then.