Bug 10278 - [3.2 regression] ICE in parser
Summary: [3.2 regression] ICE in parser
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: ---
Assignee: Mark Mitchell
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2003-03-31 14:36 UTC by Gwenole Beauchesne
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gwenole Beauchesne 2003-03-31 14:36:00 UTC
As a user reported in <http://gcc.gnu.org/ml/gcc-bugs/2003-03/msg01836.html>

With GNU C++ version 3.2.3 20030329 (prerelease)

[gb@hp6 gcc]$ ./cc1plus ~/vrac/parens3.C
 int main()
/home/gb/vrac/parens3.C:5: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

With GNU C++ version 3.4 20030329 (experimental)

[gb@hp6 gcc]$ ./cc1plus ~/vrac/parens3.C
 int main()
/home/gb/vrac/parens3.C:5: error: expected identifier
/home/gb/vrac/parens3.C:5: internal compiler error: tree check: expected
   identifier_node, have error_mark in lookup_label, at cp/decl.c:4770
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

This is a regression from
gcc version 2.95.4 20011002 (Debian prerelease)
gcc version 2.96 20000731 (Mandrake Linux 9.1 2.96-0.82mdk, aka 2.96-RH 110)

Also fails with 3.0.4

Release:
GNU C++ version 3.2.3 20030329 (prerelease)

Environment:
i686-pc-linux-gnu

How-To-Repeat:
/* { dg-do compile } */
int main(void)
{
  char x, y;
  if ('A' == x) && ('B' == y)) { } /* { error "parse error" } */
  if (x == 'A') && (y == 'B')) { } /* { error "parse error" } */
}
Comment 1 Gwenole Beauchesne 2003-03-31 14:36:00 UTC
Fix:
Fixed in GCC 3.3 with:

http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02565.html

Fixed in GCC 3.4 with:

http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02588.html
Comment 2 Wolfgang Bangerth 2003-03-31 15:52:40 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. A regression on all active branches.
Comment 3 Mark Mitchell 2003-03-31 18:53:35 UTC
Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-Why: Working on a fix.
Comment 4 Mark Mitchell 2003-03-31 20:00:29 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10278
Date: 31 Mar 2003 20:00:29 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	mmitchel@gcc.gnu.org	2003-03-31 20:00:28
 
 Modified files:
 	gcc/cp         : ChangeLog spew.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/parse: crash2.C 
 
 Log message:
 	PR c++/10278
 	* spew.c (yyerror): Avoid crashing at all costs.
 	
 	PR c++/10278
 	* g++.dg/parse/crash2.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.102&r2=1.3076.2.103
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/spew.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.76.2.1&r2=1.76.2.2
 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.130&r2=1.2261.2.131
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/crash2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
 

Comment 5 Mark Mitchell 2003-03-31 20:00:29 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10278
Date: 31 Mar 2003 20:00:29 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	mmitchel@gcc.gnu.org	2003-03-31 20:00:28
 
 Modified files:
 	gcc/cp         : ChangeLog spew.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/parse: crash2.C 
 
 Log message:
 	PR c++/10278
 	* spew.c (yyerror): Avoid crashing at all costs.
 	
 	PR c++/10278
 	* g++.dg/parse/crash2.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.102&r2=1.3076.2.103
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/spew.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.76.2.1&r2=1.76.2.2
 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.130&r2=1.2261.2.131
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/crash2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
 

Comment 6 Mark Mitchell 2003-03-31 21:42:48 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10278
Date: 31 Mar 2003 21:42:48 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2003-03-31 21:42:47
 
 Modified files:
 	gcc            : ChangeLog c-common.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/parse: crash2.C 
 
 Log message:
 	PR c++/10278
 	* c-common.c (finish_label_address_expr): Handle the
 	error_mark_node.
 	
 	PR c++/10278
 	* g++.dg/parse/crash2.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.17276&r2=1.17277
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.406&r2=1.407
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2562&r2=1.2563
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/crash2.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
 

Comment 7 Mark Mitchell 2003-03-31 21:42:48 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10278
Date: 31 Mar 2003 21:42:48 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2003-03-31 21:42:47
 
 Modified files:
 	gcc            : ChangeLog c-common.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/parse: crash2.C 
 
 Log message:
 	PR c++/10278
 	* c-common.c (finish_label_address_expr): Handle the
 	error_mark_node.
 	
 	PR c++/10278
 	* g++.dg/parse/crash2.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.17276&r2=1.17277
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.406&r2=1.407
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2562&r2=1.2563
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/crash2.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
 
Comment 8 Joe Buck 2003-04-25 19:30:04 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed for 3.3 and mainline.