aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/openmp.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2020-07-23 17:36:41 +0200
committerTobias Burnus <tobias@codesourcery.com>2020-07-23 17:37:35 +0200
commit084dc63a0200e60e0fbb7c36b412a158d234f5c0 (patch)
tree1784a06569c8d7ca9735980ef56f4d233ec25cb1 /gcc/fortran/openmp.c
parentad1bea3a4b30482686be9245af78f994722f2fec (diff)
downloadgcc-084dc63a0200e60e0fbb7c36b412a158d234f5c0.zip
gcc-084dc63a0200e60e0fbb7c36b412a158d234f5c0.tar.gz
gcc-084dc63a0200e60e0fbb7c36b412a158d234f5c0.tar.bz2
OpenMP: Support 'lastprivate (conditional:' in Fortran
gcc/fortran/ChangeLog: * gfortran.h (gfc_omp_namelist): Add lastprivate_conditional. * openmp.c (gfc_match_omp_clauses): Handle 'conditional:' modifier of 'lastprivate'. * trans-openmp.c (gfc_omp_clause_default_ctor): Don't assert on OMP_CLAUSE__CONDTEMP_ and other OMP_*TEMP_. (gfc_trans_omp_variable_list): Handle lastprivate_conditional. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/lastprivate-conditional-1.f90: New test. * gfortran.dg/gomp/lastprivate-conditional-2.f90: New test. * gfortran.dg/gomp/lastprivate-conditional-3.f90: New test. * gfortran.dg/gomp/lastprivate-conditional-4.f90: New test. * gfortran.dg/gomp/lastprivate-conditional-5.f90: New test.
Diffstat (limited to 'gcc/fortran/openmp.c')
-rw-r--r--gcc/fortran/openmp.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index e89ae29..f8f2439 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -1355,10 +1355,22 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
break;
case 'l':
if ((mask & OMP_CLAUSE_LASTPRIVATE)
- && gfc_match_omp_variable_list ("lastprivate (",
- &c->lists[OMP_LIST_LASTPRIVATE],
- true) == MATCH_YES)
- continue;
+ && gfc_match ("lastprivate ( ") == MATCH_YES)
+ {
+ bool conditional = gfc_match ("conditional : ") == MATCH_YES;
+ head = NULL;
+ if (gfc_match_omp_variable_list ("",
+ &c->lists[OMP_LIST_LASTPRIVATE],
+ false, NULL, &head) == MATCH_YES)
+ {
+ gfc_omp_namelist *n;
+ for (n = *head; n; n = n->next)
+ n->u.lastprivate_conditional = conditional;
+ continue;
+ }
+ gfc_current_locus = old_loc;
+ break;
+ }
end_colon = false;
head = NULL;
if ((mask & OMP_CLAUSE_LINEAR)