@@ -1,3 +1,8 @@
+2015-01-18 Trevor Saunders <tsaunders@mozilla.com>
+
+ * parser.c (cp_parser_pragma): Check if ivdep pragma is within a
+ function.
+
2015-01-09 Michael Collison <michael.collison@linaro.org>
* call.c: Include hash-set.h, machmode.h, vec.h, double-int.h,
@@ -32202,6 +32202,13 @@ cp_parser_pragma (cp_parser *parser, enum pragma_context context)
case PRAGMA_IVDEP:
{
+ if (context == pragma_external)
+ {
+ error_at (pragma_tok->location,
+ "%<#pragma GCC ivdep%> must be inside a function");
+ break;
+ }
+
cp_parser_skip_to_pragma_eol (parser, pragma_tok);
cp_token *tok;
tok = cp_lexer_peek_token (the_parser->lexer);
new file mode 100644
@@ -0,0 +1,11 @@
+// { dg-do compile }
+void foo() {}
+int x;
+#pragma GCC ivdep // { dg-error "must be inside a function" }
+for ( ; ) // { dg-error "expected unqualified-id before" }
+ ;
+
+ void baz() {}
+#pragma GCC ivdep // { dg-error "must be inside a function" }
+ for (int x = 0; ) // { dg-error "expected unqualified-id before" }
+ ;
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org> Hi, not doing $subject caused ICES when we tried to parse statements outside of functions. Just copy the similar code for other pragmas that effect statements. bootstrapped + regtested x86_64-linux-gnu, ok? Trev