Bug 47240 - Compiler crashes upon encountering e := e;
Summary: Compiler crashes upon encountering e := e;
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL: http://cs.atu.edu/~morell/error.html
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-07-04 01:20 UTC by Larry Morell
Modified: 2007-04-18 16:34 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-07-25 13:50:31 UTC
Embargoed:


Attachments (Terms of Use)

Description Larry Morell 2001-07-04 01:20:38 UTC
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

Comment 1 Jakub Jelinek 2001-07-25 13:50:26 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.