OSDN Git Service

gcc/testsuite/
[pf3gnuchains/gcc-fork.git] / libgomp / testsuite / libgomp.fortran / nestedfn2.f90
1 ! { dg-do run }
2
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) call abort
28     if (i + 10 .ne. vari) call abort
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