title: "PROCEDURE attribute conflicts with INTENT attribute" when compiling simple Fortran program with module
body: <p>I have a simple Fortran 95 program</p>
  
  <pre><code>include "sandboxlib.f95"
  program sandbox
      implicit none
      write(*, *) 'abc'
  end program
  </code></pre>
  
  <p>and a simple module containing a function</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I compile <code>sandbox.f95</code> with this command</p>
  
  <pre><code>/usr/bin/gfortran -O -std=gnu -Wfatal-errors -pedantic -Wall sandbox.f95 -o sandbox
  </code></pre>
  
  <p>which results in this error</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>I looked around and found a <a href="https://stackoverflow.com/a/8413337/2766558">few</a> <a href="https://stackoverflow.com/q/36487824/2766558">questions</a> that discuss modules, functions, etc. or an error like this, but I can't figure out why this won't compile.</p>