comparison libgomp/testsuite/libgomp.fortran/nestedfn1.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
comparison
equal deleted inserted replaced
-1:000000000000 0:a06113de4d67
1 ! { dg-do run }
2
3 integer :: a, b, c
4 a = 1
5 b = 2
6 c = 3
7 call foo
8 if (a .ne. 7) call abort
9 contains
10 subroutine foo
11 use omp_lib
12 logical :: l
13 l = .false.
14 !$omp parallel shared (a) private (b) firstprivate (c) &
15 !$omp num_threads (2) reduction (.or.:l)
16 if (a .ne. 1 .or. c .ne. 3) l = .true.
17 !$omp barrier
18 if (omp_get_thread_num () .eq. 0) then
19 a = 4
20 b = 5
21 c = 6
22 end if
23 !$omp barrier
24 if (omp_get_thread_num () .eq. 1) then
25 if (a .ne. 4 .or. c .ne. 3) l = .true.
26 a = 7
27 b = 8
28 c = 9
29 else if (omp_get_num_threads () .eq. 1) then
30 a = 7
31 end if
32 !$omp barrier
33 if (omp_get_thread_num () .eq. 0) then
34 if (a .ne. 7 .or. b .ne. 5 .or. c .ne. 6) l = .true.
35 end if
36 !$omp barrier
37 if (omp_get_thread_num () .eq. 1) then
38 if (a .ne. 7 .or. b .ne. 8 .or. c .ne. 9) l = .true.
39 end if
40 !$omp end parallel
41 if (l) call abort
42 end subroutine foo
43 end