gcc behavior on memory exhaustion

Andrew Roberts andrewm.roberts@sky.com
Wed Aug 9 13:05:00 GMT 2017


I routinely build the weekly snapshots and RC's, on x64, arm and aarch64.

The last gcc 8 snapshot and the two recent 7.2 RC's have failed to build 
on aarch64 (Raspberry Pi 3, running Arch Linux ARM). I have finally 
traced this to the system running out of memory. I guess a recent kernel 
update had changed the memory page size and the swap file was no longer 
being used because the page sizes didn't match.

Obviously this is my issue, but the error's I was getting from gcc did 
not help. I was getting ICE's, thus:

/usr/local/gcc/bin/g++ -Wall -Wextra -Wno-ignored-qualifiers 
-Wno-sign-compare -Wno-write-strings -std=c++14 -pipe -march=armv8-a 
-mcpu=cortex-a53 -mtune=cortex-a53 -ftree-vectorize -O3 
-DUNAME_S=\"linux\" -DUNAME_M=\"aarch64\" -DOSMESA=1 -I../libs/include 
-DRASPBERRY_PI -I/usr/include/freetype2 -I/usr/include/harfbuzz 
-I/usr/include/unicode   -c -o glerr.o glerr.cpp
{standard input}: Assembler messages:
{standard input}: Warning: end of file not at end of a line; newline 
inserted
{standard input}:204: Error: operand 1 must be an integer register -- `mov'
{standard input}: Error: open CFI at the end of file; missing 
.cfi_endproc directive
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
make: *** [<builtin>: glerr.o] Error 4
make: *** Waiting for unfinished jobs....

I was seeing the problem when building using make -j2. Both building gcc 
and building large user projects.

There are two issues here:

1) There was discussion about increasing the amount of memory gcc would 
reserve to help speed up compilation of large source files, I wondered 
if this could be a factor.

2) It would be nice to see some sort of out of memory error, rather than 
just an ICE.

The system has 858Mb of  RAM without the swap file.

Building a single source file seems to use up to 97% of the available 
memory (for a 2522 line C++ source file).

make -j2 is enough to cause the failure.

Regards

Andrew Roberts








More information about the Gcc mailing list