From Bugzilla Helper: User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2 i586) Description of problem: Compiling: int get (int &e){ e := e; } crashes the compiler; evidence is supplied on http://cs.atu.edu/~morell/error.html How reproducible: Always Steps to Reproduce: 1. Put the line int get (int &e){ e := e; } in a file by itself. I called it a.cc 2. g++ a.cc 3. Actual Results: g++ a.cc a.cc: In function `int get (int &)': a.cc:1: Internal error: Segmentation fault. Please submit a full bug report. See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions. Expected Results: $ g++ a.cc a.cc: In function `int get(int &)': a.cc:1: parse error before `=' # This is the compiler that succeed (older version) $ g++ -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) Additional info: $ g++ -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) This is the compiler that failed
Should be fixed by 2001-07-25 Jakub Jelinek <jakub> * lex.c (real_yylex): Don't crash on :=. * g++.old-deja/g++.other/crash60.C: New test. --- gcc/cp/lex.c.jj Tue Jul 24 20:41:16 2001 +++ gcc/cp/lex.c Wed Jul 25 16:00:52 2001 @@ -4564,7 +4564,10 @@ real_yylex () case '=': value = EQCOMPARE; yylval.code = EQ_EXPR; goto done; } - value = ASSIGN; goto done; + if (c != ':') + { + value = ASSIGN; goto done; + } } else if (c == c1) switch (c) --- gcc/testsuite/g++.old-deja/g++.other/crash60.C.jj Wed Jul 25 16:06:37 2001 +++ gcc/testsuite/g++.old-deja/g++.other/crash60.C Wed Jul 25 16:07:09 2001 @@ -0,0 +1,7 @@ +// Build don't link: + +void foo () +{ + int e; + e := e; // ERROR - parse error +} (this bug was introduced in July 1999 and went away in September 2000 in CVS gcc with introduction of integrated preprocessor. This patch will make it into gcc-2.96-96.