http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57961
Bug ID: 57961 Summary: Excessive memory use with -O0 ? Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dcb314 at hotmail dot com Created attachment 30540 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30540&action=edit C source code I just tried to compile the attached code with -O0. Over 4 Gig of RAM seemed to be required to compile it with gcc trunk from 20130721, but gcc 481 seems to compile it ok in 1 Gig. [dcb@localhost foundBugs]$ (ulimit -v 4000000; /home/dcb/gcc/results/bin/gcc -O0 -c bug115.c) bug115.c: In function ‘VLparse’: bug115.c:18324:9: warning: passing argument 1 of ‘VLerror’ discards ‘const’ qualifier from pointer target type [enabled by default] VLerror (yymsgp); ^ bug115.c:4726:13: note: expected ‘char *’ but argument is of type ‘const char *’ extern void VLerror( char* msg ); ^ virtual memory exhausted: Cannot allocate memory [dcb@localhost foundBugs]$ /home/dcb/gcc/results/bin/gcc -v Using built-in specs. COLLECT_GCC=/home/dcb/gcc/results/bin/gcc COLLECT_LTO_WRAPPER=/home/dcb/gcc/results/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../src/trunk/configure --prefix=/home/dcb/gcc/results --enable-checking=yes --enable-languages=c,c++,fortran Thread model: posix gcc version 4.9.0 20130721 (experimental) [trunk revision 193500] (GCC) [dcb@localhost foundBugs]$ (ulimit -v 1000000; /usr/bin/gcc -O0 -c bug115.c) bug115.c: In function ‘VLparse’: bug115.c:18324:9: warning: passing argument 1 of ‘VLerror’ discards ‘const’ qualifier from pointer target type [enabled by default] VLerror (yymsgp); ^ bug115.c:4726:13: note: expected ‘char *’ but argument is of type ‘const char *’ extern void VLerror( char* msg ); ^ [dcb@localhost foundBugs]$ /usr/bin/gcc -v Using built-in specs. COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.1/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.1-20130603/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.1-20130603/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.1 20130603 (Red Hat 4.8.1-1) (GCC) [dcb@localhost foundBugs]$ Suggest code rework.