Bug 60633 - When boostrapping 4.8.2 cc1 crashes with memory allocation problem
Summary: When boostrapping 4.8.2 cc1 crashes with memory allocation problem
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.8.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: memory-hog
Depends on:
Blocks:
 
Reported: 2014-03-24 12:52 UTC by Chris Zimmermann
Modified: 2016-09-11 20:47 UTC (History)
0 users

See Also:
Host: arm5vtel-unknown-linux-gnueabi
Target: arm5vtel-unknown-linux-gnueabi
Build: arm5vtel-unknown-linux-gnueabi
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Preprocessed source as requested (28.09 KB, text/plain)
2014-03-24 14:18 UTC, Chris Zimmermann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Zimmermann 2014-03-24 12:52:59 UTC
When trying to compile gcc 4.8.2, cc1 tries to allocate a ludicrous amount of memory when building libgcc as part of stage 1:

make all-target-libgcc 2>&1
Checking multilib configuration for libgcc...
make[1]: Entering directory `/volume1/homes/nasuser/dev/dsm/build_gcc/static/armv5tel-unknown-linux-gnueabi/libgcc'
# If this is the top-level multilib, build all the other
# multilibs.
/volume1/homes/nasuser/dev/dsm/build_gcc/static/./gcc/xgcc -B/volume1/homes/nasuser/dev/dsm/build_gcc/static/./gcc/ -B/opt2/armv5tel-unknown-linux-gnueabi/bin/ -B/opt2/armv5tel-unknown-linux-gnueabi/lib/ -isystem /opt2/armv5tel-unknown-linux-gnueabi/include -isystem /opt2/armv5tel-unknown-linux-gnueabi/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -fPIC -fno-inline -I. -I. -I../.././gcc -I../../../../gcc-4.8.2/libgcc -I../../../../gcc-4.8.2/libgcc/. -I../../../../gcc-4.8.2/libgcc/../gcc -I../../../../gcc-4.8.2/libgcc/../include  -DHAVE_CC_TLS  -o _absvsi2.o -MT _absvsi2.o -MD -MP -MF _absvsi2.dep -DL_absvsi2 -c ../../../../gcc-4.8.2/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS

cc1: out of memory allocating 4294967272 bytes after a total of 778240 bytes
make[1]: *** [_absvsi2.o] Error 1
make[1]: Leaving directory `/volume1/homes/nasuser/dev/dsm/build_gcc/static/armv5tel-unknown-linux-gnueabi/libgcc'
make: *** [all-target-libgcc] Error 2

Target platform is armvtel-unknown-linux-gnueabi, build configuration is as follows: configure --disable-multilib --prefix=/opt2 --disable-nls --enable-languages=c. Build directory is different from source directory hierarchy.
Comment 1 Andrew Pinski 2014-03-24 13:04:27 UTC
Which compiler did you start with?  This really sounds like a bug in the original compiler if it is truly stage 1. 

Also can you provide the preprocessed source?
Comment 2 Chris Zimmermann 2014-03-24 14:18:42 UTC
Created attachment 32435 [details]
Preprocessed source as requested
Comment 3 Chris Zimmermann 2014-03-24 14:23:07 UTC
The native compiler of the build system is gcc 4.2.3.

An strace dump confirms that stage 1 cc1 is picked up from /volume1/homes/nasuser/dev/dsm/build_gcc/static/./gcc/ as the first -B option suggests.

Running /volume1/homes/nasuser/dev/dsm/build_gcc/static/./gcc/xgcc -B/volume1/homes/nasuser/dev/dsm/build_gcc/static/./gcc/ -B/opt2/armv5tel-unknown-linux-gnueabi/bin/ -B/opt2/armv5tel-unknown-linux-gnueabi/lib/ -isystem /opt2/armv5tel-unknown-linux-gnueabi/include -isystem /opt2/armv5tel-unknown-linux-gnueabi/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -fPIC -fno-inline -I. -I. -I../.././gcc -I../../../../gcc-4.8.2/libgcc -I../../../../gcc-4.8.2/libgcc/. -I../../../../gcc-4.8.2/libgcc/../gcc -I../../../../gcc-4.8.2/libgcc/../include  -DHAVE_CC_TLS -DL_absvsi2 ../../../../gcc-4.8.2/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS -I../armv5tel-unknown-linux-gnueabi/libgcc/ -E >_absvsi2.i

generates the attached preprocessed source.

Let me know if more details are required.
Comment 4 Chris Zimmermann 2014-03-24 14:25:12 UTC
PS: At first, I thought I had spotted a duplicate of #45177 but then this is no cross-compilation and #45177 has been marked "fixed" in the tracker log with the fix confirmed working.
Comment 5 Andrew Pinski 2016-09-11 20:47:42 UTC
4.2.3 is no longer supported.  You should get a new binary build of GCC and try building a newer version from that.