2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / nestedfn2.f90
blob34054ad49373b2404f7ea763a75896585450df3b
1 ! { dg-do run }
3 integer :: i
4 common /c/ i
5 i = -1
6 !$omp parallel shared (i) num_threads (4)
7 call test1
8 !$omp end parallel
9 end
10 subroutine test1
11 integer :: vari
12 call test2
13 call test3
14 contains
15 subroutine test2
16 use omp_lib
17 integer :: i
18 common /c/ i
19 !$omp single
20 i = omp_get_thread_num ()
21 call test4
22 !$omp end single copyprivate (vari)
23 end subroutine test2
24 subroutine test3
25 integer :: i
26 common /c/ i
27 if (i .lt. 0 .or. i .ge. 4) STOP 1
28 if (i + 10 .ne. vari) STOP 2
29 end subroutine test3
30 subroutine test4
31 use omp_lib
32 vari = omp_get_thread_num () + 10
33 end subroutine test4
34 end subroutine test1