Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 47240

Summary: Compiler crashes upon encountering e := e;
Product: [Retired] Red Hat Linux Reporter: Larry Morell <morell>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
URL: http://cs.atu.edu/~morell/error.html
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-07-25 13:50:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.