INTENT with POINTER formal parameters
Tobias Burnus
burnus@net-b.de
Thu Jun 13 13:26:00 GMT 2013
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
More information about the Fortran
mailing list