diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2021-09-20 12:13:31 +0200 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2021-09-20 12:13:31 +0200 |
commit | 0de4184baca19cdd4ebc2d8aa2d538330cae51ee (patch) | |
tree | ecc54fa767818f38c668f288e38bfaf62fa1c5c5 /gcc/fortran/openmp.c | |
parent | 24f99147b9264f8f7d9cfb2fa6bd431edfa252d2 (diff) | |
download | gcc-0de4184baca19cdd4ebc2d8aa2d538330cae51ee.zip gcc-0de4184baca19cdd4ebc2d8aa2d538330cae51ee.tar.gz gcc-0de4184baca19cdd4ebc2d8aa2d538330cae51ee.tar.bz2 |
Fortran/OpenMP: unconstrained/reproducible ordered modifier
gcc/fortran/ChangeLog:
* gfortran.h (gfc_omp_clauses): Add order_unconstrained.
* dump-parse-tree.c (show_omp_clauses): Dump it.
* openmp.c (gfc_match_omp_clauses): Match unconstrained/reproducible
modifiers to ordered(concurrent).
(OMP_DISTRIBUTE_CLAUSES): Accept ordered clause.
(resolve_omp_clauses): Reject ordered + order on same directive.
* trans-openmp.c (gfc_trans_omp_clauses, gfc_split_omp_clauses): Pass
on unconstrained modifier of ordered(concurrent).
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/order-5.f90: New test.
* gfortran.dg/gomp/order-6.f90: New test.
* gfortran.dg/gomp/order-7.f90: New test.
* gfortran.dg/gomp/order-8.f90: New test.
* gfortran.dg/gomp/order-9.f90: New test.
Diffstat (limited to 'gcc/fortran/openmp.c')
-rw-r--r-- | gcc/fortran/openmp.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index a64b7f5..9ee52d6 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -2369,9 +2369,23 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, break; case 'o': if ((mask & OMP_CLAUSE_ORDER) - && !c->order_concurrent - && gfc_match ("order ( concurrent )") == MATCH_YES) + && (m = gfc_match_dupl_check (!c->order_concurrent, "order (")) + != MATCH_NO) { + if (m == MATCH_ERROR) + goto error; + if (gfc_match (" reproducible : concurrent )") == MATCH_YES + || gfc_match (" concurrent )") == MATCH_YES) + ; + else if (gfc_match (" unconstrained : concurrent )") == MATCH_YES) + c->order_unconstrained = true; + else + { + gfc_error ("Expected ORDER(CONCURRENT) at %C " + "with optional %<reproducible%> or " + "%<unconstrained%> modifier"); + goto error; + } c->order_concurrent = true; continue; } @@ -3475,7 +3489,8 @@ cleanup: | OMP_CLAUSE_SHARED | OMP_CLAUSE_REDUCTION) #define OMP_DISTRIBUTE_CLAUSES \ (omp_mask (OMP_CLAUSE_PRIVATE) | OMP_CLAUSE_FIRSTPRIVATE \ - | OMP_CLAUSE_LASTPRIVATE | OMP_CLAUSE_COLLAPSE | OMP_CLAUSE_DIST_SCHEDULE) + | OMP_CLAUSE_LASTPRIVATE | OMP_CLAUSE_COLLAPSE | OMP_CLAUSE_DIST_SCHEDULE \ + | OMP_CLAUSE_ORDER) #define OMP_SINGLE_CLAUSES \ (omp_mask (OMP_CLAUSE_PRIVATE) | OMP_CLAUSE_FIRSTPRIVATE) #define OMP_ORDERED_CLAUSES \ @@ -5643,7 +5658,9 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses, if (omp_clauses->orderedc && omp_clauses->orderedc < omp_clauses->collapse) gfc_error ("ORDERED clause parameter is less than COLLAPSE at %L", &code->loc); - + if (omp_clauses->order_concurrent && omp_clauses->ordered) + gfc_error ("ORDER clause must not be used together ORDERED at %L", + &code->loc); if (omp_clauses->if_expr) { gfc_expr *expr = omp_clauses->if_expr; |