aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-07-13 08:25:04 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-07-13 08:25:04 +0200
commit704686049d5eb2d54fe62585d2c17c5ef00dbb83 (patch)
tree0278c5ad8b6326931917d793acc35b41b2a6b73f /gcc/gimplify.c
parentbf85a0385f07887c35c32d62cf9d015b4ae58d22 (diff)
downloadgcc-704686049d5eb2d54fe62585d2c17c5ef00dbb83.zip
gcc-704686049d5eb2d54fe62585d2c17c5ef00dbb83.tar.gz
gcc-704686049d5eb2d54fe62585d2c17c5ef00dbb83.tar.bz2
gimplify.c (struct gimplify_omp_ctx): Add order_concurrent member.
* gimplify.c (struct gimplify_omp_ctx): Add order_concurrent member. (omp_notice_threadprivate_variable): Diagnose threadprivate variable uses inside of order(concurrent) constructs. (gimplify_scan_omp_clauses): Set ctx->order_concurrent if OMP_CLAUSE_ORDER is seen. * omp-low.c (struct omp_context): Add order_concurrent member. (scan_sharing_clauses): Set ctx->order_concurrent if OMP_CLAUSE_ORDER is seen. (check_omp_nesting_restrictions): Diagnose ordered or atomic inside of simd order(concurrent). Diagnose constructs not allowed inside of for order(concurrent). (setjmp_or_longjmp_p): Add a context and TREE_PUBLIC check to avoid complaining about static double setjmp (double); or class static methods or non-global namespace setjmps. (omp_runtime_api_call): New function. (scan_omp_1_stmt): Diagnose OpenMP runtime API calls inside of order(concurrent) loops. * c-c++-common/gomp/order-3.c: New test. * c-c++-common/gomp/order-4.c: New test. From-SVN: r273464
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index ca7ad33..66df5c5 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -222,6 +222,7 @@ struct gimplify_omp_ctx
bool distribute;
bool target_firstprivatize_array_bases;
bool add_safelen1;
+ bool order_concurrent;
int defaultmap[4];
};
@@ -7025,14 +7026,24 @@ omp_notice_threadprivate_variable (struct gimplify_omp_ctx *ctx, tree decl,
struct gimplify_omp_ctx *octx;
for (octx = ctx; octx; octx = octx->outer_context)
- if ((octx->region_type & ORT_TARGET) != 0)
+ if ((octx->region_type & ORT_TARGET) != 0
+ || octx->order_concurrent)
{
n = splay_tree_lookup (octx->variables, (splay_tree_key)decl);
if (n == NULL)
{
- error ("threadprivate variable %qE used in target region",
- DECL_NAME (decl));
- error_at (octx->location, "enclosing target region");
+ if (octx->order_concurrent)
+ {
+ error ("threadprivate variable %qE used in a region with"
+ " %<order(concurrent)%> clause", DECL_NAME (decl));
+ error_at (octx->location, "enclosing region");
+ }
+ else
+ {
+ error ("threadprivate variable %qE used in target region",
+ DECL_NAME (decl));
+ error_at (octx->location, "enclosing target region");
+ }
splay_tree_insert (octx->variables, (splay_tree_key)decl, 0);
}
if (decl2)
@@ -9263,11 +9274,14 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
case OMP_CLAUSE_NOGROUP:
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
- case OMP_CLAUSE_ORDER:
case OMP_CLAUSE_IF_PRESENT:
case OMP_CLAUSE_FINALIZE:
break;
+ case OMP_CLAUSE_ORDER:
+ ctx->order_concurrent = true;
+ break;
+
case OMP_CLAUSE_DEFAULTMAP:
enum gimplify_defaultmap_kind gdmkmin, gdmkmax;
switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (c))