diff options
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 279bd2b..a438974 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -73,6 +73,7 @@ struct gimplify_omp_ctx location_t location; enum omp_clause_default_kind default_kind; bool is_parallel; + bool is_combined_parallel; }; struct gimplify_ctx @@ -259,7 +260,7 @@ splay_tree_compare_decl_uid (splay_tree_key xa, splay_tree_key xb) /* Create a new omp construct that deals with variable remapping. */ static struct gimplify_omp_ctx * -new_omp_context (bool is_parallel) +new_omp_context (bool is_parallel, bool is_combined_parallel) { struct gimplify_omp_ctx *c; @@ -269,6 +270,7 @@ new_omp_context (bool is_parallel) c->privatized_types = pointer_set_create (); c->location = input_location; c->is_parallel = is_parallel; + c->is_combined_parallel = is_combined_parallel; c->default_kind = OMP_CLAUSE_DEFAULT_SHARED; return c; @@ -4452,6 +4454,18 @@ omp_is_private (struct gimplify_omp_ctx *ctx, tree decl) else return false; } + else if ((n->value & GOVD_EXPLICIT) != 0 + && (ctx == gimplify_omp_ctxp + || (ctx->is_combined_parallel + && gimplify_omp_ctxp->outer_context == ctx))) + { + if ((n->value & GOVD_FIRSTPRIVATE) != 0) + error ("iteration variable %qs should not be firstprivate", + IDENTIFIER_POINTER (DECL_NAME (decl))); + else if ((n->value & GOVD_REDUCTION) != 0) + error ("iteration variable %qs should not be reduction", + IDENTIFIER_POINTER (DECL_NAME (decl))); + } return true; } @@ -4467,12 +4481,13 @@ omp_is_private (struct gimplify_omp_ctx *ctx, tree decl) and previous omp contexts. */ static void -gimplify_scan_omp_clauses (tree *list_p, tree *pre_p, bool in_parallel) +gimplify_scan_omp_clauses (tree *list_p, tree *pre_p, bool in_parallel, + bool in_combined_parallel) { struct gimplify_omp_ctx *ctx, *outer_ctx; tree c; - ctx = new_omp_context (in_parallel); + ctx = new_omp_context (in_parallel, in_combined_parallel); outer_ctx = ctx->outer_context; while ((c = *list_p) != NULL) @@ -4717,7 +4732,8 @@ gimplify_omp_parallel (tree *expr_p, tree *pre_p) { tree expr = *expr_p; - gimplify_scan_omp_clauses (&OMP_PARALLEL_CLAUSES (expr), pre_p, true); + gimplify_scan_omp_clauses (&OMP_PARALLEL_CLAUSES (expr), pre_p, true, + OMP_PARALLEL_COMBINED (expr)); push_gimplify_context (); @@ -4743,7 +4759,7 @@ gimplify_omp_for (tree *expr_p, tree *pre_p) for_stmt = *expr_p; - gimplify_scan_omp_clauses (&OMP_FOR_CLAUSES (for_stmt), pre_p, false); + gimplify_scan_omp_clauses (&OMP_FOR_CLAUSES (for_stmt), pre_p, false, false); t = OMP_FOR_INIT (for_stmt); gcc_assert (TREE_CODE (t) == MODIFY_EXPR); @@ -4825,7 +4841,7 @@ gimplify_omp_workshare (tree *expr_p, tree *pre_p) { tree stmt = *expr_p; - gimplify_scan_omp_clauses (&OMP_CLAUSES (stmt), pre_p, false); + gimplify_scan_omp_clauses (&OMP_CLAUSES (stmt), pre_p, false, false); gimplify_to_stmt_list (&OMP_BODY (stmt)); gimplify_adjust_omp_clauses (&OMP_CLAUSES (stmt)); |