A specification expression is a restricted expression that is of
type integer and has a scalar value. This type of expression
appears only in the declaration of array bounds and character
lengths.
In a restricted expression, each operation is intrinsic and each
operand is one of the following:
o A constant or subobject of a constant
o A variable that is one of the following:
- A dummy argument that does not have the OPTIONAL or
INTENT (OUT) attribute (or the subobject of such
a variable)
- In a common block (or the subobject of such a variable)
- Made accessible by use or host association (or the
subobject of such a variable)
o A structure constructor whose components are restricted
expressions
o An implied-do variable within an array constructor where the
bounds and strides of the corresponding implied-do are
initialization expressions
o A reference to one of the following inquiry functions:
BIT_SIZE NWORKERS
DIGITS PRECISION
EPSILON PROCESSORS_SHAPE
HUGE RADIX
ILEN RANGE
KIND SHAPE
LBOUND SIZE
LEN SIZEOF
MAXEXPONENT TINY
MINEXPONENT UBOUND
NUMBER_OF_PROCESSORS
Each function argument must be one of the following:
- A restricted expression
- A variable whose properties inquired about are not
dependent on the upper bound of the last dimension
of an assumed-size array, are not defined by an
expression that is a restricted expression, or are
not definable by an ALLOCATE or pointer assignment
statement.
o A reference to any other intrinsic function where each argument
is a restricted expression.
o A reference to a specification function (see below) where each
argument is a restricted expression
o An array constructor where each element, and bounds and strides
of each implied-do are expressions whose primaries are
restricted expressions
o Another restricted expression enclosed in parentheses
Each subscript, section subscript, and substring starting and
ending point must be a restricted expression.
Specification functions can be used in specification expressions to
indicate the attributes of data objects. A specification function
is a pure function. It cannot have a dummy procedure argument or
be any of the following:
o An intrinsic function
o An internal function
o A statement function
o Defined as RECURSIVE
A variable in a specification expression must have its type and
type parameters (if any) specified in one of the following ways:
o By a previous declaration in the same scoping unit
o By the implicit typing rules currently in effect for the
scoping unit
o By host or use association
If a variable in a specification expression is typed by the
implicit typing rules, its appearance in any subsequent type
declaration statement must confirm the implied type and type
parameters.
If a specification expression invokes an inquiry function for a
type parameter or an array bound of an object, the type parameter
or array bound must be specified in a prior specification statement
(or to the left of the inquiry function in the same statement).