This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Constraints on variables in pure procedures
- From: "THOMAS Paul Richard 169137" <paul dot richard dot thomas at cea dot fr>
- To: <fortran at gcc dot gnu dot org>
- Date: Fri, 3 Mar 2006 15:59:08 +0100
- Subject: 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