Print

Print


From: "W.J. Metzger" <[log in to unmask]>
Sent: Monday, 28 March 2011 11:20 PM

> It seems that the order of statements is important in the following,
> since both ifort and gfortran give the same error.
> But I don't understand why that must be so.  Could someone explain?

PARAMETER statements come before any statements using
the variables defined by it.

> This routine gives an error message
>       Subroutine B (IFL, T, TA)
>       Integer, Intent(IN)  :: IFL
>       Real,    Intent(OUT) :: T(3,KTMX), TA(KTMX)
>       Integer, Parameter :: KTMX=20
>       t = ifl
>       ta = ifl
>       End Subroutine B
> 
> But the following two variations of it do not
>       Subroutine G1 (IFL, T, TA)
>       Integer, Intent(IN)  :: IFL
>       Real,    Intent(OUT) :: T, TA
>       Integer, Parameter :: KTMX=20
>       Dimension T(3,KTMX), TA(KTMX)
>       t = ifl
>       ta = ifl
>       End Subroutine G1
> 
>       Subroutine G2 (IFL, T, TA)
>       Integer, Parameter :: KTMX=20
>       Integer, Intent(IN)  :: IFL
>       Real,    Intent(OUT) :: T(3,KTMX), TA(KTMX)
>       t = ifl
>       ta = ifl
>       End Subroutine G2