From c26dffff5c573aa7f3935dddc8300a2c8fd660a1 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 19 Aug 2011 15:25:22 +0200 Subject: re PR fortran/49792 (OpenMP workshare: Wrong result with array assignment) PR fortran/49792 * trans-expr.c (gfc_trans_assignment_1): Set OMPWS_SCALARIZER_WS bit in ompws_flags only if loop.temp_ss is NULL, and clear it if lhs needs reallocation. * trans-openmp.c (gfc_trans_omp_workshare): Don't return early if code is NULL, emit a barrier if workshare emitted no code at all and NOWAIT clause isn't present. * testsuite/libgomp.fortran/pr49792-1.f90: New test. * testsuite/libgomp.fortran/pr49792-2.f90: New test. From-SVN: r177898 --- libgomp/testsuite/libgomp.fortran/pr49792-1.f90 | 18 ++++++++++++++++++ libgomp/testsuite/libgomp.fortran/pr49792-2.f90 | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 libgomp/testsuite/libgomp.fortran/pr49792-1.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/pr49792-2.f90 (limited to 'libgomp/testsuite') diff --git a/libgomp/testsuite/libgomp.fortran/pr49792-1.f90 b/libgomp/testsuite/libgomp.fortran/pr49792-1.f90 new file mode 100644 index 0000000..cf2bb66 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr49792-1.f90 @@ -0,0 +1,18 @@ +! PR fortran/49792 +! { dg-do run } + +subroutine reverse(n, a) + integer :: n + real(kind=8) :: a(n) +!$omp parallel workshare + a(:) = a(n:1:-1) +!$omp end parallel workshare +end subroutine reverse + +program pr49792 + real(kind=8) :: a(16) = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] + real(kind=8) :: b(16) + b(:) = a(16:1:-1) + call reverse (16,a) + if (any (a.ne.b)) call abort +end program pr49792 diff --git a/libgomp/testsuite/libgomp.fortran/pr49792-2.f90 b/libgomp/testsuite/libgomp.fortran/pr49792-2.f90 new file mode 100644 index 0000000..2101028 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr49792-2.f90 @@ -0,0 +1,22 @@ +! PR fortran/49792 +! { dg-do run } +! { dg-options "-std=f2003 -fall-intrinsics" } + +subroutine reverse(n, a) + integer :: n + real(kind=8) :: a(n) +!$omp parallel workshare + a(:) = a(n:1:-1) +!$omp end parallel workshare +end subroutine reverse + +program pr49792 + integer :: b(16) + integer, allocatable :: a(:) + b = 1 +!$omp parallel workshare + a = b +!$omp end parallel workshare + if (size(a).ne.size(b)) call abort() + if (any (a.ne.b)) call abort() +end program pr49792 -- cgit v1.1