aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/gomp/proc_ptr_1.f90
blob: 952c31491edece0261c151ef464be46f11489ff0 (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
! { dg-do compile }
!
! PR 46271: [F03] OpenMP default(none) and procedure pointers
!
! Contributed by Marco Restelli <mrestelli@gmail.com>

program test
  implicit none
  integer :: i
  real :: s(1000)
  procedure(f), pointer :: pf
 
  pf => f

  !$omp parallel do schedule(static) private(i) shared(s,pf) default(none)
  do i=1,1000
    call pf(real(i),s(i))
  enddo
  !$omp end parallel do

  write(*,*) 'Sum ',sum(s)
contains
  pure subroutine f(x,y)
    real, intent(in) :: x
    real, intent(out) :: y
    y = sin(x)*cos(x)
  end subroutine
end