Passing a procedure(*) argument to another subroutine

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

Hi ionutg,

I passed this on to our compiler engineers and they determined that it is a compiler error. We have create TPR#18543 to track this issue.

Thanks for the report!
Mat

TPR 18543 - Error should not be detected for passing a procedure dummy argument

was corrected in our 12.10 release. A late update for you.

dave