Home > Net >  Changing intent(in) variables through a pointer
Changing intent(in) variables through a pointer

Time:11-04

I'm wondering if it is legal/safe to modify intent(in) dummy arguments through pointers associated with corresponding actual arguments. Specifically when the pointer association was established before the subroutine call.

For example, is the following OK (it seems to work fine with gfortran)?

program test
implicit none

type compound
  integer, allocatable :: A1(:)
  integer, pointer :: A2(:,:)
end type compound

type(compound), target :: my
integer :: n=5, i

allocate(my           
  • Related