Intel® Fortran Compiler 16.0 User and Reference Guide
A specification expression is a restricted scalar integer expression that you can use in specifications such as length type parameters and array bounds.
In a restricted expression, each operation is intrinsic and each primary is one of the following:
A constant or subobject of a constant
An object designator with a base object that is one of the following:
A dummy argument that does not have the OPTIONAL or INTENT (OUT) attribute
In a common block
Made accessible by use or host association
A local variable of the procedure containing the BLOCK construct in which the restricted expression appears
A local variable of an outer BLOCK construct containing the BLOCK construct in which the restricted expression appears
An array constructor where each element and each scalar integer expression of each Do loop is a restricted expression
A structure constructor whose components are restricted expression
A specification inquiry where each designator or function argument is a restricted expression or a variable whose properties inquired about are not one of the following:
Dependent on the upper bound of the last dimension of an assumed-size array
Deferred
Defined by an expression that is not a restricted expression
A specification inquiry that is a constant expression
A reference to the intrinsic function PRESENT
A reference to any other intrinsic function where each argument is a restricted expression
A reference to a specification function where each argument is a restricted expression
A type parameter of the derived type being defined
A DO variable within an array constructor, where each scalar integer expression of the corresponding implied-DO is a restricted expression
A restricted expression enclosed in parentheses, where each subscript, section subscript, substring starting and ending point, and type parameter value is a restricted expression, and where any final subroutine that is invoked is pure
A specification inquiry is a reference to one of the following:
Array inquiry function ALLOCATED, COSHAPE, IMAGE_INDEX, IS_CONTIGUOUS, LBOUND, LCOBOUND, PRESENT, RANK, SHAPE, SIZE, or UBOUND
Numeric inquiry function DIGITS, EPSILON, HUGE, ILEN, MAXEXPONENT, MINEXPONENT, PRECISION, RADIX, RANGE, SIZE, SIZEOF, STORAGE_SIZE, or TINY
Character inquiry function LEN or NEW_LINE
Bit inquiry function BIT SIZE
Kind inquiry function KIND
A type parameter inquiry
IEEE inquiry function IEEE_SUPPORT_DATATYPE, IEEE_SUPPORT_DENORMAL, IEEE_SUPPORT_DIVIDE, IEEE_SUPPORT_INF, IEEE_SUPPORT_IO, IEEE_SUPPORT_NAN, IEEE_SUPPORT_ROUNDING, IEEE_SUPPORT_SQRT, IEEE_SUPPORT_STANDARD, or IEEE_SUPPORT_UNDERFLOW_CONTROL from the intrinsic module IEEE_ARITHMETIC
IEEE inquiry function IEEE_SUPPORT_FLAG or IEE_SUPPORT_HALTING from the intrinsic module IEEE_EXCEPTIONS
The function C_SIZEOF from the intrinsic module ISO_C_BINDING
Specification functions can be used in specification expressions to determine the attributes of data objects.
A function is a specification function if it is a pure function, does not have a dummy procedure argument, and is not one of the following:
An standard intrinsic function
An internal function
A statement function
Defined as RECURSIVE
The requirement that specification functions be pure ensures that they cannot have side effects that could affect other objects being declared in the same specification.
The restriction that specification functions cannot be internal ensures that they cannot use host association to inquire about other objects being declared in the same specification. The restriction against recursion prevents the creation of a new instance of a procedure during construction of that procedure.
Evaluation of a specification expression must not directly or indirectly cause invocation of a procedure defined by the subprogram in which it appears.
A variable in a specification expression must have its type and type parameters (if any) specified in one of the following ways:
By a previous declaration in the same scoping unit
By the implicit typing rules currently in effect for the scoping unit
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 includes a specification inquiry that depends on a type parameter or an array bound of an entity specified in the same specification statement, the type parameter or array bound must be specified in a previous specification statement (or to the left of the inquiry function in the same statement). The previous specification cannot be in the same entity declaration. If a specification expression includes a reference to the value of an element of an array specified in the same specification statement, the array must be completely specified in previous declarations.
In a specification expression, the number of arguments for a function reference is limited to 255.
The following shows valid specification expressions:
MAX(I) + J ! I and J are scalar integer variables UBOUND(ARRAY_B,20) ! ARRAY_B is an assumed-shape dummy array