diff libgomp/testsuite/libgomp.fortran/nestedfn4.f90 @ 0:a06113de4d67

first commit
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2009 14:47:48 +0900
parents
children 84e7813d76e9
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgomp/testsuite/libgomp.fortran/nestedfn4.f90	Fri Jul 17 14:47:48 2009 +0900
@@ -0,0 +1,41 @@
+program foo
+  integer :: i, j, k
+  integer :: a(10), c(10)
+  k = 2
+  a(:) = 0
+  call test1
+  call test2
+  do i = 1, 10
+    if (a(i) .ne. 10 * i) call abort
+  end do
+  !$omp parallel do reduction (+:c)
+  do i = 1, 10
+    c = c + a
+  end do
+  do i = 1, 10
+    if (c(i) .ne. 10 * a(i)) call abort
+  end do
+  !$omp parallel do lastprivate (j)
+  do j = 1, 10, k
+  end do
+  if (j .ne. 11) call abort
+contains
+  subroutine test1
+    integer :: i
+    integer :: b(10)
+    do i = 1, 10
+      b(i) = i
+    end do
+    c(:) = 0
+    !$omp parallel do reduction (+:a)
+    do i = 1, 10
+      a = a + b
+    end do
+  end subroutine test1
+  subroutine test2
+    !$omp parallel do lastprivate (j)
+    do j = 1, 10, k
+    end do
+    if (j .ne. 11) call abort
+  end subroutine test2
+end program foo