title: Passing an internal procedure as argument
body: <p>I want to solve a differential equation lots of times for different parameters. It is more complicated than this, but for the sake of clarity let's say the ODE is <code>y'(x) = (y+a)*x</code> with <code>y(0) = 0</code> and I want <code>y(1)</code>. I picked the dverk algorithm from netlib for solving the ODE and it expects the function on the right hand side to be of a certain form. Now what I did with the Intel Fortran compiler is the following (simplified):</p>
  
  <pre><code>subroutine f(x,a,ans)
  implicite none
  double precision f,a,ans,y,tol,c(24),w(9)
  ...
  call dverk(1,faux,x,y,1.d0,tol,ind,c,1,w)
  ...
  contains
      subroutine faux(n,xx,yy,yprime)
             implicite none
             integer n
             double precision xx,yy(n),yprime(n)
             yprime(1) = (yy(1)+a)*xx
      end subroutine faux
  end subroutine f
  </code></pre>
  
  <p>This works just fine with ifort, the sub-subroutine <code>faux</code> sees the parameter <code>a</code> and everything works as expected. But I'd like the code to be compatible with gfortran, and with this compiler I get the following error message:</p>
  
  <blockquote>
    <p>Error: Internal procedure 'faux' is not allowed as an actual argument at (1)</p>
  </blockquote>
  
  <p>I need to have the <code>faux</code> routine inside <code>f</code>, or else I don't know how to tell it the value of <code>a</code>, because I can't change the list of parameters, since this is what the <code>dverk</code> routine expects.</p>
  
  <p>I would like to keep the <code>dverk</code> routine and understand how to solve this specific problem without a workaround, since I feel it will become important again when I need to integrate a parameterized function with different integrators.</p>