First, the example, “test.f90”:
module blas
contains
function ddot(n,x,dx,y,dy)
implicit none
integer :: n,dx,dy
real*8 :: x(*),y(*),ddot
integer :: i
ddot=0.0d0
do i=0,n-1
ddot=ddot+x(i*dx)*y(i*dy)
end do
end function ddot
end module blas
module middle
use blas, b_ddot=>ddot
procedure(b_ddot), pointer :: my_ddot
end module middle
function ddot(n,x,dx,y,dy)
use middle
implicit none
integer :: n,dx,dy
real*8 :: x(*),y(*),ddot
ddot=b_ddot(n,x,dx,y,dy)
end function ddot
program test
implicit none
integer, parameter :: n=100
integer :: i
real*8 :: x(n), y(n)
real*8, external :: ddot
do i=1,n
x(i)=dble(i)
y(i)=dble(n-i)
end do
write(6,*) ddot(n,x,1,y,1)
end program test
Compiling with “pgfortran test.f90” (PGI 15.3) gives:
PGF90-S-0038-Symbol, ddot, has not been explicitly declared (test.f90)
0 inform, 0 warnings, 1 severes, 0 fatal for ddot
while “gfortran” (4.8.2) works. The error disappears (and the program runs and gives the expecter result) if I comment out the procedure pointer declaration in the “middle” module, note that this pointer is never used! I had this problem with 14.7, and hoped it would be fixed with TPR 21166, but apparently it isn’t.[/code]