To: J3 08-124 From: Van Snyder Subject: FORALL example illustrating local type spec Date: 2008 February 06 The editor has suggested the desirability of an example showing the use of a in a FORALL header. [178:1-]------------------------------------------------------------------ Editor: Insert a new note after Note 7.56: "The type and kind of the \si{index-name} variables may be declared independently of the type of any normal variable in the scoping unit, for example, in SUBROUTINE S(A) IMPLICIT NONE INTEGER, PARAMETER :: BIGINT = SELECTED_INT_KIND(18) REAL A(:,:), X, Y ... FORALL (INTEGER(BIGINT)::X=1:UBOUND(A,1), Z=UBOUND(A,2),A(X,Z)/=0) A(X,Z) = 1/A(X,Z)**2 END FORALL the kind of the \si{index-name}s X and Z is selected to be big enough for subscript values even if the array A has more than $2^{31}$ elements. Since the type of the \si{index-name}s X and Z in the FORALL construct are declared explicitly in the FORALL header, it is not necessary for integer variables of the same names to be declared in the containing scoping unit. In this example, there is a variable X of type real declared in the containing scoping unit, and no variable Z declared in the containing scoping unit."