Next: Interpretation of Element Up: The FORALL Statement Previous: The FORALL Statement
Rule R215 in the Fortran 90 standard for executable-construct is extended to include the forall-stmt.
XBNF forall-stmt -to -rule to to is FORALL forall-header forall-assignment
forall-header -to -rule to to is ( forall-triplet-spec-list [ , scalar-mask-expr ] ) XBNF
Note that functions referenced in the forall-triplet-spec-list are not syntactically constrained as the scalar-mask-expr is. This is consistent with the handling of bounds expressions in DO loops. (End of rationale.)
XBNF forall-triplet-spec -to -rule to to is index-name = subscript : subscript [ : stride ] XBNF
XBNF forall-assignment -to -rule to to is assignment-stmt -to or pointer-assignment-stmt XBNF
To determine the set of permitted values for each index-name in the forall-header, we introduce some simplifying notation. In the forall-triplet-spec, let
If stride is missing, it is as if it were present with the value 1. Stride must not have the value 0. The set of permitted values is determined on entry to the statement and is , . If for some index-name, the forall-assignment is not executed.
A FORALL statement assigns to memory locations specified by the forall-assignment for permitted values of the index-name variables. A program that causes multiple values to be assigned to the same location is not HPF-conforming and therefore has no defined meaning. This is a semantic constraint rather than a syntactic constraint, however; in general, it cannot be checked during compilation.