diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2020-05-13 10:06:45 +0200 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2020-05-13 10:06:45 +0200 |
commit | f884bef21cccc05d748fd7869cd641cbb4f6b6bb (patch) | |
tree | ed7ca416894ca3fa773b4bb4edebb46e593bb2fe /libgomp/testsuite/libgomp.fortran/pr66199-3.f90 | |
parent | 3d96f7b92415b7a277a87e7825efc958030e20b6 (diff) | |
download | gcc-f884bef21cccc05d748fd7869cd641cbb4f6b6bb.tar.gz |
[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 'libgomp/testsuite/libgomp.fortran/pr66199-3.f90')
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/pr66199-3.f90 | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.fortran/pr66199-3.f90 b/libgomp/testsuite/libgomp.fortran/pr66199-3.f90 new file mode 100644 index 00000000000..7c596dc1739 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr66199-3.f90 @@ -0,0 +1,53 @@ +! { dg-do run } +! +! PR fortran/94690 +! PR middle-end/66199 + +module m + integer u(0:1024-1), v(0:1024-1), w(0:1024-1) +contains + +integer(8) function f1 (a, b) + implicit none + integer, value :: a, b + integer(8) :: d + !$omp parallel do lastprivate (d) default(none) firstprivate (a, b) shared(u, v, w) + do d = a, b-1 + u(d) = v(d) + w(d) + end do + f1 = d +end + +integer(8) function f2 (a, b, c) + implicit none + integer, value :: a, b, c + integer(8) :: d, e + !$omp parallel do lastprivate (d) default(none) firstprivate (a, b) shared(u, v, w) linear(c:5) lastprivate(e) + do d = a, b-1 + u(d) = v(d) + w(d) + c = c + 5 + e = c + end do + f2 = d + c + e +end + +integer(8) function f3 (a1, b1, a2, b2) + implicit none + integer, value :: a1, b1, a2, b2 + integer(8) d1, d2 + !$omp parallel do default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) + do d1 = a1, b1-1 + do d2 = a2, b2-1 + u(d1 * 32 + d2) = v(d1 * 32 + d2) + w(d1 * 32 + d2) + end do + end do + f3 = d1 + d2 +end +end module m + +program main + use m + if (f1 (0, 1024) /= 1024) stop 1 + if (f2 (0, 1024, 17) /= 1024 + 2 * (17 + 5 * 1024)) stop 2 + if (f3 (0, 32, 0, 32) /= 64) stop 3 +end program main |