When writing and calling pure subroutines in Fortran 90 using gfortran, how do I find out why the compiler emits this error?
Error: Subroutine call to XXXX at (1) is not PURE
I'll try to pose my question as specifically as I can while at the same time being general enough to be useful to others, so I'll avoid pasting in my actual code and instead will sketch what happened.
I understand there are various rules about pure procedures in Fortran 90, which I think basically boil down to not permitting side-effects in either functions or subroutines, and not permitting changes to subroutine parameters declared with intent(in)
. I've a series of subroutines which initially were not declared to be pure, and whose parameters didn't have declared intent, but which nevertheless didn't perform side-effects. First, I changed all parameter declarations to have explicitly-declared intent, either in
, out
, or inout
. Then, I declared all the subroutines to be PURE
. Naturally, many errors occurred on the first attempt, but the compiler told me what the errors were (such-and-such parameter with intent(in)
is being modified, for example), so one-by-one I fixed them all.
There are calls among these procedures, however, and so now I still get many errors of the form shown above: Subroutine call to XXXX at (1) is not PURE
. What I don't understand is why the call is not pure. I've done everything I can think of to make XXXX pure, but the compiler still thinks it isn't.
So my question --rephrased-- is: how do I get gfortran to tell me WHY it thinks XXXX is not pure?