2018-01-22 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / nestedfn1.f90
blob67dadd6dfc1229870a7d86425d297ceef0390b00
1 ! { dg-do run }
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