Constraints on variables in pure procedures

THOMAS Paul Richard 169137 paul.richard.thomas@cea.fr
Fri Mar 3 14:59:00 GMT 2006


In casting an eye over PR20863, I think that I uncovered another problem.

If I have understood things correctly, the intention of the constraints
on variables within pure procedures is to:

(i) Prevent a pure procedure to change the value of global variables,
dummy arguments with INTENT(IN), or no declared intent, and objects that
are associated with any part of a global variable; and to
(ii) Prevent the procedure from making pointers to such variables.

Thus, I do not understand the following and cannot find any reference to
it in the standard:

$ cat pr20863a.f90
PURE FUNCTION give_next(i)
     TYPE node_type
       sequence
       TYPE(node_type), POINTER :: next
     END TYPE
     TYPE(node_type), POINTER :: node
     TYPE(node_type), target  :: t
     integer, intent(in)      :: i
     node%next = t
END FUNCTION

THOMASP@PC-THOMAS-P /cygdrive/d/svn/prs
$ /irun/bin/gfortran -c pr20863a.f90
 In file pr20863a.f90:9

     node%next = t
                1
Error: Right side of assignment at (1) is a derived type containing a
POINTER in a PURE procedure

If t were a dummy argument, this would be correct would it not?

Paul





More information about the Fortran mailing list