User account creation filtered due to spam.

Bug 20563 - [3.4/4.0/4.1 Regression] Infinite loop in diagnostic (and ice after error message)
Summary: [3.4/4.0/4.1 Regression] Infinite loop in diagnostic (and ice after error mes...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.3
: P2 normal
Target Milestone: 3.4.5
Assignee: Volker Reichelt
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: diagnostic, error-recovery, ice-on-invalid-code, monitored, patch
Depends on:
Blocks:
 
Reported: 2005-03-20 01:55 UTC by Giovanni Bajo
Modified: 2005-07-11 13:01 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3.6 3.4.5 4.0.2 4.1.0
Known to fail: 3.4.0 3.4.4 4.0.0 4.0.1
Last reconfirmed: 2005-05-28 18:12:09


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Giovanni Bajo 2005-03-20 01:55:55 UTC
The following program:

--------------------------------
int foo(int dest)
{
  int x = 0;
   __label__ l1, l2, l3;
   __label__ *lb[] = { &&l1, &&l2, &&l3 };

   goto **lb[dest];

l1:
   x += 1;
l2:
   x += 1;
l3:
   x += 1;
   return x;
}
--------------------------------

produce an infinite loop in diagnostic when compiled with G++ 3.4.3:


label.cc:5: error: expected identifier before '*' token
label.cc:5: error: expected `,' before '*' token
label.cc:5: error: expected identifier before '*' token
label.cc:5: error: expected `,' before '*' token
label.cc:5: error: expected identifier before '*' token
label.cc:5: error: expected `,' before '*' token
label.cc:5: error: expected identifier before '*' token
label.cc:5: error: expected `,' before '*' token
label.cc:5: error: expected identifier before '*' token
label.cc:5: error: expected `,' before '*' token
label.cc:5: error: expected identifier before '*' token
label.cc:5: error: expected `,' before '*' token
label.cc:5: error: expected identifier before '*' token
[....]
Comment 1 Andrew Pinski 2005-03-20 02:00:05 UTC
With checking enabled we get an ICE:
t.cc: In function `int foo(int)':
t.cc:5: error: expected identifier before '*' token
t.cc:5: internal compiler error: tree check: expected identifier_node, have error_mark in 
declare_local_label, at cp/decl.c:2162
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

And this is a regression from 3.3.3.
Comment 2 Andrew Pinski 2005-03-24 18:10:54 UTC
: Search converges between 2002-12-14-trunk (#159) and 2002-12-29-trunk (#160).


This started with the new parser.
Comment 3 Volker Reichelt 2005-06-07 09:33:06 UTC
Testing a patch.
Comment 4 CVS Commits 2005-06-08 11:09:24 UTC
Subject: Bug 20563

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	reichelt@gcc.gnu.org	2005-06-08 11:09:13

Modified files:
	gcc/cp         : ChangeLog parser.c pt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/ext: label4.C 
	gcc/testsuite/g++.dg/template: ptrmem15.C 

Log message:
	PR c++/19894
	* pt.c (tsubst): Reject pointer-to-member of type void.
	
	* g++.dg/template/ptrmem15.C: New test.
	
	PR c++/20563
	* parser.c (cp_parser_label_declaration): Deal with invalid/missing
	identifiers.
	
	* g++.dg/ext/label4.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4781&r2=1.4782
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.339&r2=1.340
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.1003&r2=1.1004
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5612&r2=1.5613
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/label4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/ptrmem15.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 6 Volker Reichelt 2005-06-08 11:28:38 UTC
Fixed on mainline (will become GCC 4.1.0)
and the 3.4-branch (will become GCC 3.4.5).

Waiting for the 4.0 branch to thaw.
Comment 8 Volker Reichelt 2005-07-11 13:01:06 UTC
Now also fixed on the 4.0 branch.