Bug 12608 - internal compiler error: tree check: expected class 't', have 'x' (error_mark) in cp_parser_class_specifier, at cp/parser.c:11264
Summary: internal compiler error: tree check: expected class 't', have 'x' (error_mark...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 minor
Target Milestone: 3.4.2
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on: 16964 16971
Blocks:
  Show dependency treegraph
 
Reported: 2003-10-14 00:29 UTC by Carlo Wood
Modified: 2004-08-12 15:39 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-07-01 03:51:12


Attachments
preprocessed header file with stripped line numbers. (107.30 KB, text/plain)
2003-10-14 00:33 UTC, Carlo Wood
Details
g++ -v output (38.45 KB, text/plain)
2003-10-14 00:36 UTC, Carlo Wood
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Carlo Wood 2003-10-14 00:29:07 UTC
While investigation my last bug report, I ran into ANOTHER ice...

Reproduce with:

g++-cvs-3.4 -include pppch.h -c -o pppch.h.gch pppch.h

pppch.h is attached.

The full output of the above with '-v' is attached too (its big).
Comment 1 Carlo Wood 2003-10-14 00:33:21 UTC
Created attachment 4929 [details]
preprocessed header file with stripped line numbers.
Comment 2 Carlo Wood 2003-10-14 00:36:14 UTC
Created attachment 4930 [details]
g++ -v output

Interesting info only at beginning and end.
Comment 3 Andrew Pinski 2003-10-14 05:03:23 UTC
This is not a regression (if the header was just a source file, .cc, GCC still ICE's).  Every GCC from 
2.91.6 to the mainline, ICE on this test.  I have not reduced this problem yet though but it looks 
like an easy fix though (I do not have the time to fix it though).
Comment 4 Carlo Wood 2003-11-07 18:08:29 UTC
Andrew Pinski reproduced this, see comment #3.
Comment 5 Andrew Pinski 2003-12-23 19:17:25 UTC
This still ICE's:
pr12608.cc:18044: internal compiler error: tree check: expected class 't', have 'x' 
(error_mark) in cp_parser_class_specifier, at cp/parser.c:11540
Please submit a full bug report,with preprocessed source if appropriate.See <URL:http://
gcc.gnu.org/bugs.html> for instructions.
Comment 6 Andrew Pinski 2004-04-01 13:43:59 UTC
Still happens on the mainline:
pr12608.cc:18044: internal compiler error: tree check: expected class 't', have 'x' 
(error_mark) in cp_parser_class_specifier, at cp/parser.c:11854
Please submit a full bug report,with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
I might submit a simple fix for this.
  if (type != error_mark_node)
    type = finish_struct (type, attributes);
  if (pop_p)
    pop_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (type)));
Comment 7 Andrew Pinski 2004-07-01 03:51:12 UTC
Here is the latested ICE:
pr12608.cc:18044: internal compiler error: tree check: expected class 't', have 'x' (error_mark) in 
cp_parser_class_specifier, at cp/parser.c:12368
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 8 Volker Reichelt 2004-08-10 17:13:57 UTC
The failure I get with gcc 3.4.x can be reduced to

===========================
struct A
{
    struct B;
};

struct A::B {};
struct A::B {};
===========================

which is tracked in PR 16964.


On mainline I get a different failure which can be reduced to

===========================
namespace N
{
    int i;
    int i;
}
===========================

bug.cc:8: error: redefinition of `int N::i'
bug.cc:7: error: `int N::i' previously declared here
bug.cc:8: internal compiler error: tree check: expected class 'd', have 'x'
(error_mark) in cp_parser_init_declarator, at cp/parser.c:10717
Please submit a full bug report, [etc.]

which is also a redefinition problem. I opened a separate PR for this one:
PR 16971


I'd like to keep this PR open until all problems got fixed, because it is
an excellent testcase for finding all sorts of redefinition problems.
Comment 9 Volker Reichelt 2004-08-12 15:39:30 UTC
With gcc 3.4.2-20040812 and mainline from the same date, I only get
error messages and no more ICE's.
Thus, the problems got fixed for gcc 3.4.2.

The code still crashes with the 3.3 branch, but since the underlying
bugs are only error-recovery problems they won't get fixed on that
branch.