Managing derived types with pointers

The actual argument must have the target attribute (or itself be a pointer). That’s just the way pointers and targets work in fortran. If the actual argument does not have the target attribute, then the dummy argument might be a copy, which would mean that the pointer to that copy would lose its target upon return.

If the only purpose of the subroutine is to do the pointer assignment, then that could just as easily be done in the calling program and the subroutine could be eliminated.

1 Like