Hi everyone
I am tryingto pass a subroutine f() as an argument to subroutine a() and then to b()
call a(f)
subroutine a(f)
procedure(sub) :: f
call b(f)
end subroutine
subroutine b(f)
procedure(sub) :: f
call f()
end subroutine
but if fails with
PGF90-S-0448-Argument number 1 to b must be a subroutine name (r.f90: 24)
ifort and gfortran compile and run just fine.
Am I missing anything?
Thanks a lot,
Ionut
Here is a full code to play with:
module m
abstract interface
subroutine sub(i)
integer :: i
end subroutine
end interface
contains
subroutine c(i)
integer :: i
print *, 'F was called with i=', i
end subroutine
end module
program r
use m
call a(c)
contains
subroutine a(f)
procedure(sub) :: f
print *, 'A calling B'
call b(f)
end subroutine
subroutine b(f)
procedure(sub) :: f
print *, 'B calling F'
call f(5)
end subroutine
end program