20563 – [3.4/4.0/4.1 Regression] Infinite loop in diagnostic (and ice after error message)

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 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.