Hi, this was reported by Lukas Ruf (ruf at rawip org) on gcc-bugs 29 May 2003, however I can't find it in the database (or even in the list archive...?). Test case: struct parameter_struct_t { char short_option; char *long_option; }; parameter_struct_t *parameters[] = { { 'f'; "from"; }; }; % g++ --version g++ (GCC) 3.3.1 20030619 (prerelease) % g++ -c away.cc away.cc:8: error: syntax error before `;' token [killed because out of memory] mainline says: away.cc:8: error: expected `}' away.cc:8: error: expected `}' away.cc:8: error: brace-enclosed initializer used to initialize ` parameter_struct_t*' away.cc:9: error: expected unqualified-id away.cc:9: error: expected `,' or `;' away.cc:10: error: expected declaration
Confirmed. GCC 3.3 stucks forever with the given code.
I've just run into very similiar problem. The code with cause 3.2 to produce error message, causes 3.3 to eat all virtual memory. g++ version is: Reading specs from /usr/lib/gcc-lib/i386-linux/3.3/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i386-linux Thread model: posix gcc version 3.3 (Debian) The complete command was: g++-3.3 -save-temps -x c++ -Wall -ftemplate-depth-100 -O0 -fno-inline -g -DDEBUG_CFG -I"." -I".." -I"../../lib" -I"../../lib/nstl" -I"../cpp_mark" -I"/space/NM/boost" -I"/space/NM/boost-sandbox" -I"bin/gcc/debug/main-target-nm_asm_analysis" -I"bin/gcc/debug/main-target-nm_asm" -I"../cpp_mark/bin/gcc/debug/main-target-cpp_lite" -I"bin/gcc/debug" -I"../cpp_mark/bin/gcc/debug" -c -o "bin/gcc/debug/main-target-nm_asm_analysis/instruction_instance.o" "xxx.cpp" virtual memory exhausted: Cannot allocate memory The offending line from xxx.cpp file is visit(const Whale::NonterminalNonsense____LiteralExpression& t); where there's no such class in namespace Whale. I'm attaching the preprocessed file.
Created attachment 4307 [details] Preprocessed file which triggers infinite memory usage.
Subject: Bug 11282 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: nathan@gcc.gnu.org 2003-07-23 16:43:02 Modified files: gcc/cp : ChangeLog decl.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/parse: crash7.C Log message: cp: PR c++/11282 * decl.c: (reshape_init): Always advance *INITP. testsuite: PR c++/11282 * g++.dg/parse/crash7.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.185&r2=1.3076.2.186 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.965.2.56&r2=1.965.2.57 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.241&r2=1.2261.2.242 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/crash7.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1
fixed the first bug for 3.3.1 2003-07-23 Nathan Sidwell <nathan@codesourcery.com> PR c++/11282 * decl.c: (reshape_init): Always advance *INITP.
Since the first bug was fixed for gcc 3.3.1, I'm closing the PR. I opened another problem report, namely PR 13349, for the unrelated second bug.