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]

Re: INTENT with POINTER formal parameters


Angelo Graziosi wrote:
As you see the routine "sub" declare the formal parameter "a" as

   real, pointer, intent(in) :: a(:,:)

i.e. it uses INTENT with the pointer variable. Now on a Fortran book I read

REAL, POINTER :: z(:) ! NB: INTENT not allowed here with POINTER

So which is true? Perhaps that was valid only with F90/95 and F2003/2008 allow it, now...

Try:  gfortran -std=f95 hj444.f90


    real, pointer, intent(in) :: a(:,:)
                 1
Error: Fortran 2003: POINTER attribute with INTENT attribute at (1)


Note: The INTENT only applies to the pointer association status - not to the value of its target. Thus, for intent(in):
  A = 5  ! Valid (when a is associated)
  A => B ! Invalid
  allocate(A) ! Invalid

Tobias


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