summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/reduction3.f90
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libgomp/testsuite/libgomp.fortran/reduction3.f90
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libgomp/testsuite/libgomp.fortran/reduction3.f90')
-rw-r--r--libgomp/testsuite/libgomp.fortran/reduction3.f90103
1 files changed, 103 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.fortran/reduction3.f90 b/libgomp/testsuite/libgomp.fortran/reduction3.f90
new file mode 100644
index 000000000..89b9d1af6
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/reduction3.f90
@@ -0,0 +1,103 @@
+! { dg-do run }
+!$ use omp_lib
+
+ integer (kind = 4) :: i, ia (6), n, cnt
+ real :: r, ra (4)
+ double precision :: d, da (5)
+ logical :: v
+
+ i = 1
+ ia = 2
+ r = 3
+ ra = 4
+ d = 5.5
+ da = 6.5
+ v = .false.
+ cnt = -1
+
+!$omp parallel num_threads (3) private (n) reduction (.or.:v) &
+!$omp & reduction (max:i, ia, r, ra, d, da)
+!$ if (i .ne. -huge(i)-1 .or. any (ia .ne. -huge(ia)-1)) v = .true.
+!$ if (r .ge. -1.0d38 .or. any (ra .ge. -1.0d38)) v = .true.
+!$ if (d .ge. -1.0d300 .or. any (da .ge. -1.0d300)) v = .true.
+ n = omp_get_thread_num ()
+ if (n .eq. 0) then
+ cnt = omp_get_num_threads ()
+ i = 4
+ ia(3:5) = -2
+ ia(1) = 7
+ r = 5
+ ra(1:2) = 6.5
+ d = -2.5
+ da(2:4) = 8.5
+ else if (n .eq. 1) then
+ i = 2
+ ia(4:6) = 5
+ r = 1
+ ra(2:4) = -1.5
+ d = 8.5
+ da(1:3) = 2.5
+ else
+ i = 1
+ ia = 1
+ r = -1
+ ra = -1
+ d = 1
+ da = -1
+ end if
+!$omp end parallel
+ if (v) call abort
+ if (cnt .eq. 3) then
+ if (i .ne. 4 .or. any (ia .ne. (/7, 2, 2, 5, 5, 5/))) call abort
+ if (r .ne. 5 .or. any (ra .ne. (/6.5, 6.5, 4., 4./))) call abort
+ if (d .ne. 8.5 .or. any (da .ne. (/6.5, 8.5, 8.5, 8.5, 6.5/))) call abort
+ end if
+
+ i = 1
+ ia = 2
+ r = 3
+ ra = 4
+ d = 5.5
+ da = 6.5
+ v = .false.
+ cnt = -1
+
+!$omp parallel num_threads (3) private (n) reduction (.or.:v) &
+!$omp & reduction (min:i, ia, r, ra, d, da)
+!$ if (i .ne. 2147483647 .or. any (ia .ne. 2147483647)) v = .true.
+!$ if (r .le. 1.0d38 .or. any (ra .le. 1.0d38)) v = .true.
+!$ if (d .le. 1.0d300 .or. any (da .le. 1.0d300)) v = .true.
+ n = omp_get_thread_num ()
+ if (n .eq. 0) then
+ cnt = omp_get_num_threads ()
+ i = 4
+ ia(3:5) = -2
+ ia(1) = 7
+ r = 5
+ ra(1:2) = 6.5
+ d = -2.5
+ da(2:4) = 8.5
+ else if (n .eq. 1) then
+ i = 2
+ ia(4:6) = 5
+ r = 1
+ ra(2:4) = -1.5
+ d = 8.5
+ da(1:3) = 2.5
+ else
+ i = 1
+ ia = 1
+ r = -1
+ ra = 7
+ ra(3) = -8.5
+ d = 1
+ da(1:4) = 6
+ end if
+!$omp end parallel
+ if (v) call abort
+ if (cnt .eq. 3) then
+ if (i .ne. 1 .or. any (ia .ne. (/1, 1, -2, -2, -2, 1/))) call abort
+ if (r .ne. -1 .or. any (ra .ne. (/4., -1.5, -8.5, -1.5/))) call abort
+ if (d .ne. -2.5 .or. any (da .ne. (/2.5, 2.5, 2.5, 6., 6.5/))) call abort
+ end if
+end