diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2020-07-23 17:36:41 +0200 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2020-07-23 17:37:35 +0200 |
commit | 084dc63a0200e60e0fbb7c36b412a158d234f5c0 (patch) | |
tree | 1784a06569c8d7ca9735980ef56f4d233ec25cb1 /gcc/fortran/trans-openmp.c | |
parent | ad1bea3a4b30482686be9245af78f994722f2fec (diff) | |
download | gcc-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/trans-openmp.c')
-rw-r--r-- | gcc/fortran/trans-openmp.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 56bc7cd..d12d7fb 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -613,10 +613,21 @@ gfc_omp_clause_default_ctor (tree clause, tree decl, tree outer) tree type = TREE_TYPE (decl), size, ptr, cond, then_b, else_b; stmtblock_t block, cond_block; - gcc_assert (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_PRIVATE - || OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_LASTPRIVATE - || OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_LINEAR - || OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_REDUCTION); + switch (OMP_CLAUSE_CODE (clause)) + { + case OMP_CLAUSE__LOOPTEMP_: + case OMP_CLAUSE__REDUCTEMP_: + case OMP_CLAUSE__CONDTEMP_: + case OMP_CLAUSE__SCANTEMP_: + return NULL; + case OMP_CLAUSE_PRIVATE: + case OMP_CLAUSE_LASTPRIVATE: + case OMP_CLAUSE_LINEAR: + case OMP_CLAUSE_REDUCTION: + break; + default: + gcc_unreachable (); + } if ((! GFC_DESCRIPTOR_TYPE_P (type) || GFC_TYPE_ARRAY_AKIND (type) != GFC_ARRAY_ALLOCATABLE) @@ -1678,6 +1689,10 @@ gfc_trans_omp_variable_list (enum omp_clause_code code, tree node = build_omp_clause (input_location, code); OMP_CLAUSE_DECL (node) = t; list = gfc_trans_add_clause (node, list); + + if (code == OMP_CLAUSE_LASTPRIVATE + && namelist->u.lastprivate_conditional) + OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (node) = 1; } } return list; |