This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: INTENT with POINTER formal parameters
- From: Tobias Burnus <burnus at net-b dot de>
- To: Angelo Graziosi <angelo dot graziosi at alice dot it>
- Cc: fortran <fortran at gcc dot gnu dot org>
- Date: Thu, 13 Jun 2013 15:26:23 +0200
- Subject: Re: INTENT with POINTER formal parameters
- References: <51B9C360 dot 1010405 at alice dot it>
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