aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/procptr1.f90
blob: 44410d47b53dfb25e9a983b4ac4709f2371a5519 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
! { dg-do run }
  interface
    integer function foo ()
    end function
    integer function bar ()
    end function
    integer function baz ()
    end function
  end interface
  procedure(foo), pointer :: ptr
  integer :: i
  ptr => foo
!$omp parallel shared (ptr)
  if (ptr () /= 1) stop 1
!$omp end parallel
  ptr => bar
!$omp parallel firstprivate (ptr)
  if (ptr () /= 2) stop 2
!$omp end parallel
!$omp parallel sections lastprivate (ptr)
!$omp section
  ptr => foo
  if (ptr () /= 1) stop 3
!$omp section
  ptr => bar
  if (ptr () /= 2) stop 4
!$omp section
  ptr => baz
  if (ptr () /= 3) stop 5
!$omp end parallel sections
  if (ptr () /= 3) stop 6
  if (.not.associated (ptr, baz)) stop 7
end
integer function foo ()
  foo = 1
end function
integer function bar ()
  bar = 2
end function
integer function baz ()
  baz = 3
end function