2008-01-22 Jakub Jelinek <jakub@redhat.com>
+ PR c++/34607
+ * c-parser.c (c_parser_omp_for_loop): Don't call c_finish_omp_for
+ if DECL_INITIAL (decl) is error_mark_node.
+
PR c++/34914
* c-common.c (handle_vector_size_attribute): Only allow
integral, scalar float and fixed point types. Handle OFFSET_TYPE
decl = check_for_loop_decls ();
if (decl == NULL)
goto error_init;
+ if (DECL_INITIAL (decl) == error_mark_node)
+ decl = error_mark_node;
init = decl;
}
else if (c_parser_next_token_is (parser, CPP_NAME)
c_break_label = save_break;
c_cont_label = save_cont;
- /* Only bother calling c_finish_omp_for if we havn't already generated
+ /* Only bother calling c_finish_omp_for if we haven't already generated
an error from the initialization parsing. */
if (decl != NULL && decl != error_mark_node && init != error_mark_node)
return c_finish_omp_for (loc, decl, init, cond, incr, body, NULL);
2008-01-22 Jakub Jelinek <jakub@redhat.com>
+ PR c++/34607
+ * semantics.c (finish_omp_for): Don't call c_finish_omp_for
+ if decl or init is error_mark_node.
+
PR c++/34918
* error.c (dump_expr): Handle VECTOR_CST.
finish_omp_for (location_t locus, tree decl, tree init, tree cond,
tree incr, tree body, tree pre_body)
{
- tree omp_for;
+ tree omp_for = NULL;
if (decl == NULL)
{
TREE_OPERAND (cond, n)
= fold_build_cleanup_point_expr (TREE_TYPE (t), t);
}
- omp_for = c_finish_omp_for (locus, decl, init, cond, incr, body, pre_body);
+ if (decl != error_mark_node && init != error_mark_node)
+ omp_for = c_finish_omp_for (locus, decl, init, cond, incr, body, pre_body);
if (omp_for != NULL
&& TREE_CODE (OMP_FOR_INCR (omp_for)) == MODIFY_EXPR
&& TREE_SIDE_EFFECTS (TREE_OPERAND (OMP_FOR_INCR (omp_for), 1))
2008-01-22 Jakub Jelinek <jakub@redhat.com>
+ PR c++/34607
+ * gcc.dg/gomp/pr34607.c: New test.
+ * g++.dg/gomp/pr34607.C: New test.
+
PR c++/34914
* g++.dg/ext/vector10.C: New test.
--- /dev/null
+// PR c++/34607
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+void
+foo ()
+{
+#pragma omp for
+ for (int i =; i < 2; ++i) // { dg-error "expected primary-expression" }
+ ;
+#pragma omp for
+ for (T i = 54; i < 56; i++) // { dg-error "was not declared|expected" }
+ ;
+ T j; // { dg-error "was not declared|expected" }
+#pragma omp for
+ for (j = 1; j < 3; j++) // { dg-error "was not declared" }
+ ; // { dg-error "expected" }
+}
--- /dev/null
+/* PR c++/34607 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -std=gnu99" } */
+
+void
+foo ()
+{
+#pragma omp for
+ for (int i =; i < 2; ++i) /* { dg-error "expected expression before" } */
+ ;
+#pragma omp for
+ for (T i = 54; i < 56; i++) /* { dg-error "expected iteration declaration" } */
+ ;
+ T j; /* { dg-error "undeclared|for each function|expected" } */
+#pragma omp for
+ for (j = 1; j < 3; j++) /* { dg-error "undeclared" } */
+ ;
+}