diff options
Diffstat (limited to 'gcc/gimplify.cc')
-rw-r--r-- | gcc/gimplify.cc | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index 98f5544..cd17966 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -12319,17 +12319,34 @@ gimplify_omp_task (tree *expr_p, gimple_seq *pre_p) tree expr = *expr_p; gimple *g; gimple_seq body = NULL; + bool nowait = false; + bool has_depend = false; if (OMP_TASK_BODY (expr) == NULL_TREE) - for (tree c = OMP_TASK_CLAUSES (expr); c; c = OMP_CLAUSE_CHAIN (c)) - if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND - && OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_MUTEXINOUTSET) + { + for (tree c = OMP_TASK_CLAUSES (expr); c; c = OMP_CLAUSE_CHAIN (c)) + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND) + { + has_depend = true; + if (OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_MUTEXINOUTSET) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%<mutexinoutset%> kind in %<depend%> clause on a " + "%<taskwait%> construct"); + break; + } + } + else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_NOWAIT) + nowait = true; + if (nowait && !has_depend) { - error_at (OMP_CLAUSE_LOCATION (c), - "%<mutexinoutset%> kind in %<depend%> clause on a " - "%<taskwait%> construct"); - break; + error_at (EXPR_LOCATION (expr), + "%<taskwait%> construct with %<nowait%> clause but no " + "%<depend%> clauses"); + *expr_p = NULL_TREE; + return; } + } gimplify_scan_omp_clauses (&OMP_TASK_CLAUSES (expr), pre_p, omp_find_clause (OMP_TASK_CLAUSES (expr), |