Print

Print


Aleksander's question reminded me of my nagging question about dummy
arguments with the target attribute.  My understanding is that the
target attribute prevents copy-in/copy-out which would break aliasing
established by a procedure.  My question is whether the TARGET needs
to be specified for the entire call-tree (assuming all procedures are
module procedures and hence have explicit interfaces).  An example:

  type my_type
    type(another_type), pointer :: z
    ! other components
  end type my_type

  subroutine sub1 (a, x)
    type(my_type) :: a
    type(another_type) :: x  ! Do I need TARGET here too?
    ...
    call sub1 (a, x)
    ...
  end subroutine sub1

  subroutine sub2 (a, x)
    type(my_type) :: a
    type(another_type), target :: x
    ...
    a%z => x
    ...
  end subroutine sub2

--
Neil N. Carlson                    Motorola, Los Alamos Research Park
Motorola Labs / PSRL               4200 W. Jemez Road, Suite 300
Computational Nanoscience Group    Los Alamos, New Mexico 87544

[log in to unmask]           Fax: (505) 663-5150
Voice: (505) 663-5106              Pager: [log in to unmask] or
888-946-2817