aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-openmp.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2020-05-13 10:06:45 +0200
committerTobias Burnus <tobias@codesourcery.com>2020-05-13 10:06:45 +0200
commitf884bef21cccc05d748fd7869cd641cbb4f6b6bb (patch)
treeed7ca416894ca3fa773b4bb4edebb46e593bb2fe /gcc/fortran/trans-openmp.c
parent3d96f7b92415b7a277a87e7825efc958030e20b6 (diff)
downloadgcc-f884bef21cccc05d748fd7869cd641cbb4f6b6bb.zip
gcc-f884bef21cccc05d748fd7869cd641cbb4f6b6bb.tar.gz
gcc-f884bef21cccc05d748fd7869cd641cbb4f6b6bb.tar.bz2
[Fortran] OpenMP - permit lastprivate in distribute + SIMD fixes (PR94690)
gcc/fortran/ 2020-05-13 Tobias Burnus <tobias@codesourcery.com> PR fortran/94690 * openmp.c (OMP_DISTRIBUTE_CLAUSES): Add OMP_CLAUSE_LASTPRIVATE. (gfc_resolve_do_iterator): Skip the private handling for SIMD as that is handled by ME code. * trans-openmp.c (gfc_trans_omp_do): Don't add private/lastprivate for dovar_found == 0, unless !simple. libgomp/ 2020-05-13 Tobias Burnus <tobias@codesourcery.com> PR fortran/94690 * testsuite/libgomp.fortran/pr66199-3.f90: New. * testsuite/libgomp.fortran/pr66199-4.f90: New. * testsuite/libgomp.fortran/pr66199-5.f90: New. * testsuite/libgomp.fortran/pr66199-6.f90: New. * testsuite/libgomp.fortran/pr66199-7.f90: New. * testsuite/libgomp.fortran/pr66199-8.f90: New. * testsuite/libgomp.fortran/pr66199-9.f90: New.
Diffstat (limited to 'gcc/fortran/trans-openmp.c')
-rw-r--r--gcc/fortran/trans-openmp.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 42ecd0a..8cf851e 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -4262,23 +4262,22 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock,
break;
}
}
- if (!dovar_found)
+ if (!dovar_found && op == EXEC_OMP_SIMD)
{
- if (op == EXEC_OMP_SIMD)
+ if (collapse == 1)
{
- if (collapse == 1)
- {
- tmp = build_omp_clause (input_location, OMP_CLAUSE_LINEAR);
- OMP_CLAUSE_LINEAR_STEP (tmp) = step;
- OMP_CLAUSE_LINEAR_NO_COPYIN (tmp) = 1;
- }
- else
- tmp = build_omp_clause (input_location, OMP_CLAUSE_LASTPRIVATE);
- if (!simple)
- dovar_found = 2;
+ tmp = build_omp_clause (input_location, OMP_CLAUSE_LINEAR);
+ OMP_CLAUSE_LINEAR_STEP (tmp) = step;
+ OMP_CLAUSE_LINEAR_NO_COPYIN (tmp) = 1;
+ OMP_CLAUSE_DECL (tmp) = dovar_decl;
+ omp_clauses = gfc_trans_add_clause (tmp, omp_clauses);
}
- else
- tmp = build_omp_clause (input_location, OMP_CLAUSE_PRIVATE);
+ if (!simple)
+ dovar_found = 2;
+ }
+ else if (!dovar_found && !simple)
+ {
+ tmp = build_omp_clause (input_location, OMP_CLAUSE_PRIVATE);
OMP_CLAUSE_DECL (tmp) = dovar_decl;
omp_clauses = gfc_trans_add_clause (tmp, omp_clauses);
}