diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-10-25 09:56:55 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-10-25 09:56:55 +0200 |
commit | 37bc33f72cba7ca8a13b60eea7abecb09559b0fc (patch) | |
tree | 0e3f6a5d98795f9be2cb4fcb4ec43f456d2fd761 /gcc/fortran/openmp.c | |
parent | 872324bed46845ee78c764d55eeeb5029afae532 (diff) | |
download | gcc-37bc33f72cba7ca8a13b60eea7abecb09559b0fc.zip gcc-37bc33f72cba7ca8a13b60eea7abecb09559b0fc.tar.gz gcc-37bc33f72cba7ca8a13b60eea7abecb09559b0fc.tar.bz2 |
re PR fortran/87725 (OpenMP 4.5 clause schedule(simd,monotonic:static) not understood)
PR fortran/87725
* openmp.c (gfc_match_omp_clauses): Parse simd, monotonic and
nonmonotonic modifiers regardless of if they have been parsed
already or if the opposite one has. Fix up check whether
comma after modifier should be parsed.
(resolve_omp_clauses): Diagnose schedule modifier restrictions.
* c-c++-common/gomp/schedule-modifiers-1.c (bar): Separate modifier
from kind with a colon rather than comma.
* gfortran.dg/gomp/schedule-modifiers-1.f90: New test.
* gfortran.dg/gomp/schedule-modifiers-2.f90: New test.
From-SVN: r265479
Diffstat (limited to 'gcc/fortran/openmp.c')
-rw-r--r-- | gcc/fortran/openmp.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index bd83733..6430e61 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -1710,22 +1710,17 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, locus old_loc2 = gfc_current_locus; do { - if (!c->sched_simd - && gfc_match ("simd") == MATCH_YES) + if (gfc_match ("simd") == MATCH_YES) { c->sched_simd = true; nmodifiers++; } - else if (!c->sched_monotonic - && !c->sched_nonmonotonic - && gfc_match ("monotonic") == MATCH_YES) + else if (gfc_match ("monotonic") == MATCH_YES) { c->sched_monotonic = true; nmodifiers++; } - else if (!c->sched_monotonic - && !c->sched_nonmonotonic - && gfc_match ("nonmonotonic") == MATCH_YES) + else if (gfc_match ("nonmonotonic") == MATCH_YES) { c->sched_nonmonotonic = true; nmodifiers++; @@ -1736,7 +1731,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, gfc_current_locus = old_loc2; break; } - if (nmodifiers == 0 + if (nmodifiers == 1 && gfc_match (" , ") == MATCH_YES) continue; else if (gfc_match (" : ") == MATCH_YES) @@ -4075,6 +4070,30 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses, gfc_warning (0, "INTEGER expression of SCHEDULE clause's chunk_size " "at %L must be positive", &expr->where); } + if (omp_clauses->sched_kind != OMP_SCHED_NONE + && omp_clauses->sched_nonmonotonic) + { + if (omp_clauses->sched_kind != OMP_SCHED_DYNAMIC + && omp_clauses->sched_kind != OMP_SCHED_GUIDED) + { + const char *p; + switch (omp_clauses->sched_kind) + { + case OMP_SCHED_STATIC: p = "STATIC"; break; + case OMP_SCHED_RUNTIME: p = "RUNTIME"; break; + case OMP_SCHED_AUTO: p = "AUTO"; break; + default: gcc_unreachable (); + } + gfc_error ("NONMONOTONIC modifier specified for %s schedule kind " + "at %L", p, &code->loc); + } + else if (omp_clauses->sched_monotonic) + gfc_error ("Both MONOTONIC and NONMONOTONIC schedule modifiers " + "specified at %L", &code->loc); + else if (omp_clauses->ordered) + gfc_error ("NONMONOTONIC schedule modifier specified with ORDERED " + "clause at %L", &code->loc); + } /* Check that no symbol appears on multiple clauses, except that a symbol can appear on both firstprivate and lastprivate. */ |