aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-low.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-10-20 00:52:06 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2018-10-20 00:52:06 +0200
commit173670e2b443ac501fd0ae3d61124faed8f13b22 (patch)
treece1807df0bebc49de831077fc4d3b97b0670a4c5 /gcc/omp-low.c
parentf3245887551932de6aba1aa3e9f911b78a57b5ef (diff)
downloadgcc-173670e2b443ac501fd0ae3d61124faed8f13b22.zip
gcc-173670e2b443ac501fd0ae3d61124faed8f13b22.tar.gz
gcc-173670e2b443ac501fd0ae3d61124faed8f13b22.tar.bz2
re PR middle-end/85488 (segmentation fault when compiling code using the ordered(n) clause in OpenMP 4.5)
PR middle-end/85488 PR middle-end/87649 * omp-low.c (check_omp_nesting_restrictions): Diagnose ordered without depend closely nested inside of loop with ordered clause with a parameter. * c-c++-common/gomp/doacross-2.c: New test. * c-c++-common/gomp/sink-3.c: Expect another error during error recovery. From-SVN: r265335
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r--gcc/omp-low.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index fdabf67..bbcbc12 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2762,14 +2762,25 @@ check_omp_nesting_restrictions (gimple *stmt, omp_context *ctx)
case GIMPLE_OMP_FOR:
if (gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_TASKLOOP)
goto ordered_in_taskloop;
- if (omp_find_clause (gimple_omp_for_clauses (ctx->stmt),
- OMP_CLAUSE_ORDERED) == NULL)
+ tree o;
+ o = omp_find_clause (gimple_omp_for_clauses (ctx->stmt),
+ OMP_CLAUSE_ORDERED);
+ if (o == NULL)
{
error_at (gimple_location (stmt),
"%<ordered%> region must be closely nested inside "
"a loop region with an %<ordered%> clause");
return false;
}
+ if (OMP_CLAUSE_ORDERED_EXPR (o) != NULL_TREE
+ && omp_find_clause (c, OMP_CLAUSE_DEPEND) == NULL_TREE)
+ {
+ error_at (gimple_location (stmt),
+ "%<ordered%> region without %<depend%> clause may "
+ "not be closely nested inside a loop region with "
+ "an %<ordered%> clause with a parameter");
+ return false;
+ }
return true;
case GIMPLE_OMP_TARGET:
if (gimple_omp_target_kind (ctx->stmt)