....
abstract interface
pure function fi(t,u) result (fu)
use NumberKinds
real(kp), dimension(:), intent(in) :: u
real(kp), intent(in) :: t
real(kp), dimension(size(u)) :: fu
end function fi
end interface
contains
pure function rk4_step(u,f,dt) result(un)
use NumberKinds
real(kp), intent(in) :: dt
real(kp), intent(in), dimension(:) :: u
real(kp), dimension(size(u)) :: k1,k2,k3,k4,un
procedure(fi) :: f
integer :: N
...
end function rk4_step
...
I get this error message with g95: G95 (GCC 4.0.3 (g95 0.94!) Jan 17 2013)
In file src/integrators.f95:34
pure function rk4_step(u,f,dt) result(un)
1
Error: Dummy procedure 'f' of PURE procedure at (1) must also be PURE
Makefile:28: recipe for target 'test_rk4' failed
I don't get it with gfortran: GNU Fortran (GCC) 4.8.2 20140206 (prerelease) and the program compiles without further problems
Just a compiler bug. g95 is very old, when Fortran 2003 just started to be implemented in compilers. It has decent C interop, stream access and so on, but many other features are not implemented at all.
Don't use a compiler, that has not been updated for a long time (with a small exception recently) if you need modern features support.
You can try an interface block inside
rk4_step
instead of theabstract interface
, that is Fortran 90 and works for me in g95.