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).
Created attachment 4929 [details] preprocessed header file with stripped line numbers.
Created attachment 4930 [details] g++ -v output Interesting info only at beginning and end.
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).
Andrew Pinski reproduced this, see comment #3.
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.
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)));
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.
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.
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.