Hi,
in this (mild) ICE on invalid 4.9/5 regression things go wrong in
various ways when we try to use cp_parser_iteration_statement at
top-level. I think the simplest thing to do is just returning early,
then cp_parser_declaration will emit an appropriate diagnostic (the same
produced when the pragma isn't there). Tested x86_64-linux.
Thanks,
Paolo.
///////////////////////
/cp
2015-02-05 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/60211
* parser.c (cp_parser_pragma): Handle gracefully PRAGMA_IVDEP
at pragma_external context.
/testsuite
2015-02-05 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/60211
* g++.dg/parse/ivdep-2.C: New.
* g++.dg/parse/ivdep-3.C: Likewise.
Index: cp/parser.c
===================================================================
--- cp/parser.c (revision 220440)
+++ cp/parser.c (working copy)
@@ -33079,6 +33079,9 @@ cp_parser_pragma (cp_parser *parser, enum pragma_c
cp_parser_error (parser, "for, while or do statement expected");
return false;
}
+ if (context == pragma_external)
+ /* cp_parser_declaration will emit a diagnostic. */
+ return false;
cp_parser_iteration_statement (parser, true);
return true;
}
Index: testsuite/g++.dg/parse/ivdep-2.C
===================================================================
--- testsuite/g++.dg/parse/ivdep-2.C (revision 0)
+++ testsuite/g++.dg/parse/ivdep-2.C (working copy)
@@ -0,0 +1,9 @@
+// PR c++/60211
+
+void foo()
+{}
+ int i;
+#pragma GCC ivdep
+ for (i = 0; i < 2; ++i) // { dg-error "expected|type" }
+ ;
+} // { dg-error "expected" }
Index: testsuite/g++.dg/parse/ivdep-3.C
===================================================================
--- testsuite/g++.dg/parse/ivdep-3.C (revision 0)
+++ testsuite/g++.dg/parse/ivdep-3.C (working copy)
@@ -0,0 +1,8 @@
+// PR c++/60211
+
+void foo()
+{}
+#pragma GCC ivdep
+ for (int i = 0; i < 2; ++i) // { dg-error "expected|type" }
+ ;
+} // { dg-error "expected" }