This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Constraints on variables in pure procedures


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]