I have a simple Fortran 95 program
include "sandboxlib.f95"
program sandbox
implicit none
write(*, *) 'abc'
end program
and a simple module containing a function
module sandboxlib
integer, parameter :: dp = kind(1.d0)
contains
function cumsum(mat, m, n) result(c)
implicit none
real(dp), intent(in) :: mat
integer, intent(in) :: m, n
integer i, j
real(dp), dimension(m, n) :: c
c(:, 1) = 0.d0
do i = 2, m
do j = 1, n
c(i, j) = c(i-1, j) + mat(i, j)
end do
end do
end function
end module
I compile sandbox.f95
with this command
/usr/bin/gfortran -O -std=gnu -Wfatal-errors -pedantic -Wall sandbox.f95 -o sandbox
which results in this error
sandboxlib.f95:6.23:
Included at sandbox.f95:1:
function cumsum(mat, m, n)
1
Error: PROCEDURE attribute conflicts with INTENT attribute in 'mat' at (1)
I looked around and found a few questions that discuss modules, functions, etc. or an error like this, but I can't figure out why this won't compile.