aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libgomp/testsuite/libgomp.fortran/procptr1.f90
blob: 4187739826facd55715a170b5ca5016b673a18d7 (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) call abort
!$omp end parallel
  ptr => bar
!$omp parallel firstprivate (ptr)
  if (ptr () /= 2) call abort
!$omp end parallel
!$omp parallel sections lastprivate (ptr)
!$omp section
  ptr => foo
  if (ptr () /= 1) call abort
!$omp section
  ptr => bar
  if (ptr () /= 2) call abort
!$omp section
  ptr => baz
  if (ptr () /= 3) call abort
!$omp end parallel sections
  if (ptr () /= 3) call abort
  if (.not.associated (ptr, baz)) call abort
end
integer function foo ()
  foo = 1
end function
integer function bar ()
  bar = 2
end function
integer function baz ()
  baz = 3
end function