Bug 11282 - [3.3 regression] Infinite memory usage after syntax error
Summary: [3.3 regression] Infinite memory usage after syntax error
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3
: P2 critical
Target Milestone: 3.3.1
Assignee: Not yet assigned to anyone
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Reported: 2003-06-22 12:06 UTC by Falk Hueffner
Modified: 2003-12-08 02:47 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2003-06-22 17:09:04

Preprocessed file which triggers infinite memory usage. (96.20 KB, application/octet-stream)
2003-06-30 10:15 UTC, Vladimir Prus

Note You need to log in before you can comment on or make changes to this bug.
Description Falk Hueffner 2003-06-22 12:06:40 UTC

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[] = {

% 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 `
away.cc:9: error: expected unqualified-id
away.cc:9: error: expected `,' or `;'
away.cc:10: error: expected declaration
Comment 1 Giovanni Bajo 2003-06-22 17:09:04 UTC
Confirmed. GCC 3.3 stucks forever with the given code.
Comment 2 Vladimir Prus 2003-06-30 10:14:33 UTC
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"../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. 
Comment 3 Vladimir Prus 2003-06-30 10:15:54 UTC
Created attachment 4307 [details]
Preprocessed file which triggers infinite memory usage.
Comment 5 Nathan Sidwell 2003-07-23 16:47:49 UTC
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.
Comment 6 Volker Reichelt 2003-12-08 02:47:11 UTC
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.