Note that there are some explanatory texts on larger screens.

plurals
  1. POWriting and calling pure subroutines in Fortran 90 using gfortran
    primarykey
    data
    text
    <p>When writing and calling pure subroutines in Fortran 90 using gfortran, how do I find out why the compiler emits this error?</p> <pre><code>Error: Subroutine call to XXXX at (1) is not PURE </code></pre> <p>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.</p> <p>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 <code>intent(in)</code>. 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 <code>in</code>, <code>out</code>, or <code>inout</code>. Then, I declared all the subroutines to be <code>PURE</code>. Naturally, many errors occurred on the first attempt, but the compiler told me what the errors were (such-and-such parameter with <code>intent(in)</code> is being modified, for example), so one-by-one I fixed them all. </p> <p>There are calls among these procedures, however, and so now I still get many errors of the form shown above: <code>Subroutine call to XXXX at (1) is not PURE</code>. What I don't understand is <em>why</em> 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.</p> <p>So my question --rephrased-- is: how do I get gfortran to tell me WHY it thinks XXXX is not pure?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload