Huge memory usage with current g++ :-( -> endless (?) recursion in walk_tree <expand_call_inline>

Gabriel Dos Reis gdr@codesourcery.com
Wed Jul 26 09:56:00 GMT 2000


Andreas Jaeger <aj@suse.de> writes:

| [1  <text/plain>]
| 
| Trying to bootstrap gcc from CVS with:
| /cvs/gcc/configure --prefix=/opt/gcc-2.96.test --enable-shared --enable-threads \
|          --with-gnu-as --with-gnu-ld
| on i686-linux (kernel 2.2.16, glibc 2.1.3) I noticed that compiling
| libstdc++ lead to an enourmous memory usage (my machine has 256 MB of
| main memory and g++ used more than 400 MB).  The problem occurs with
| the following command:
| 
| echo cstring
| cstring
| if [ x"-fpic" != x ]; then \
|   /builds/gcc/gcc-2.96/gcc/g++ -B/opt/gcc-2.96.test/i686-pc-linux/bin/ -B/opt/gcc-2.9
| 6.test/i686-pc-linux/lib/ -B/builds/gcc/gcc-2.96/gcc/ -isystem /opt/gcc-2.96.test/i68
| 6-pc-linux/include -L/builds/gcc/gcc-2.96/i686-pc-linux/libstdc++ -c -g -O2 -fvtable-
| thunks -D_GNU_SOURCE -fno-implicit-templates -I/cvs/gcc/libstdc++ -I/cvs/gcc/libstdc+
| +/stl -I../libio -I/cvs/gcc/libstdc++/../libio -nostdinc++ -D_IO_MTSAFE_IO -fpic -DC 
| \
|     `for N in REP MAIN TRAITS ADDSS ADDPS ADDCS ADDSP ADDSC EQSS EQPS EQSP NESS NEPS 
| NESP LTSS LTPS LTSP GTSS GTPS GTSP LESS LEPS LESP GESS GEPS GESP; do echo " -D${N}"; 
| done` \
|     /cvs/gcc/libstdc++/sinst.cc -o pic/cstrmain.o; \
| else true ; fi
| 
| Using -O1 instead of -O2 fixed this.
| 
| After setting ulimit to 128 MB I got:
| if [ x"-fpic" != x ]; then \
|   /builds/gcc/gcc-2.96/gcc/g++ -B/opt/gcc-2.96.test/i686-pc-linux/bin/ -B/opt/gcc-2.96.test/i686-pc-linux/lib/ -B/builds/gcc/gcc-2.96/gcc/ -isystem /opt/gcc-2.96.test/i686-pc-linux/include -L/builds/gcc/gcc-2.96/i686-pc-linux/libstdc++ -c -g -O2 -fvtable-thunks -D_GNU_SOURCE -fno-implicit-templates -I/cvs/gcc/libstdc++ -I/cvs/gcc/libstdc++/stl -I../libio -I/cvs/gcc/libstdc++/../libio -nostdinc++ -D_IO_MTSAFE_IO -fpic -DC \
|     `for N in REP MAIN TRAITS ADDSS ADDPS ADDCS ADDSP ADDSC EQSS EQPS EQSP NESS NEPS NESP LTSS LTPS LTSP GTSS GTPS GTSP LESS LEPS LESP GESS GEPS GESP; do echo " -D${N}"; done` \
|     /cvs/gcc/libstdc++/sinst.cc -o pic/cstrmain.o; \
| else true ; fi
| g++: Internal error: Segmentation fault (program cc1plus)
| Please submit a full bug report.

Well, I don't know if I should say you're lucky or not :-)

I reported a similar problem on the same inputs, yesterday or so.
The first time, I got a segmentation fault and the tree-checker says
something fishy was going on in expand_call_inline (a scope_stmt was
being passed instead of expr_stmt, said the tree-checker).  The next
time I tried to compile GCC, all my processes were killed and my
machine went very bad. I tried again this morning and same result.
After some analysis, I was led to conclude that was due to a
miscompilation o cc1plus caused by recent changes in the
middle/back-end -- starting from 2000-07-21.

But so far, nobody seems to experience the same problems. I'm glad to
see that I'm not dreaming.

For that matter, my system is SuSE 6.4 running on a Pentium III at
550/700. 

-- Gaby
CodeSourcery, LLC                             http://www.codesourcery.com


More information about the Gcc-bugs mailing list