http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46271

           Summary: OpenMP default(none) and procedure pointers
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: mreste...@gmail.com


gfortran rejects the attached code both in version A and B. A similar
problem is discussed in

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44036

but, to my understanding, this only covers the case of a procedure
pointer associated with a function, not the subroutine case.


gfortran --version
GNU Fortran (GCC) 4.6.0 20101019 (experimental)


With version A:
gfortran -fopenmp omp_test.f90 -o omp_test
omp_test.f90:22.59:

  !$omp   private(i) shared(s,pf) default(none) ! version A
                                                           1
Error: Object 'pf' is not a variable at (1)

With version B:
gfortran -fopenmp omp_test.f90 -o omp_test
omp_test.f90: In function ‘test’:
omp_test.f90:25:0: error: ‘pf’ not specified in enclosing parallel
omp_test.f90:23:0: error: enclosing parallel



module ma
 implicit none
contains
 pure subroutine f(x,y)
  real, intent(in) :: x
  real, intent(out) :: y
   y = sin(x)*cos(x)
 end subroutine f
end module ma

program test
 use ma, only: f
 implicit none
 integer :: i
 real :: s(1000)
 procedure(f), pointer :: pf

  pf => f

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

  write(*,*) 'Sum ',sum(s)
end program test

Reply via email to