Possible array init bug (i486-pc-linux-glibc1, C)

Maciej Babinski mbabinsk@simon.er.usgs.gov
Tue Feb 8 07:11:00 GMT 2000


System: linux 2.2.14 i486-pc-linux-glibc1
        40Mb RAM, 14Mb swap
Options:
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..
-I../gdk_imlib -I/usr/opt/packages/gtk+-1.2.6/include
-I/usr/opt/packages/glib-1.2.6/lib/glib/include
-I/usr/opt/packages/glib-1.2.6/include
-I/usr/opt/packages/gtk+-1.2.6/include
-I/usr/opt/packages/glib-1.2.6/lib/glib/include
-I/usr/opt/packages/glib-1.2.6/include
-I/usr/opt/packages/imlib-1.9.8/include
-I/usr/opt/packages/imlib-1.9.8/include  -O2 -c testimg.c

The preprocessed c code is rather lengthy, so I've put it up on the web:
http://www.imsa.edu/~maciej/testimg.i.bz2
http://www.imsa.edu/~maciej/testimg.i

The problem, as far as I can tell, is that when gcc tries to generate
code for very large initialized array it starts soaking up memory,
eventually runs out of space, and crashes. The only code in testimg.c
is the declaration of an array of about 325,000 unsigned chars (this
is is a source file in the imlib package). On my system, gcc will
take up over 40Mb of memory before it runs out and crashes, about
two-thirds of the way through generating the .s file.  If I kill off
a few processes, or add more swap space, everything goes smoothly.


More information about the Gcc-bugs mailing list