Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Assumed-Size Specifications

An assumed-size array is a dummy argument array that assumes the size (only) of its associated actual argument array, or the associate name of a RANK (*) block in a SELECT RANK construct. The rank and extents can differ for the actual and dummy arrays. An assumed-size specification takes the following form:

([expli-shape-spec,] [expli-shape-spec,] ... [dl:] *)

expli-shape-spec

Is an explicit-shape specification.

dl

Is a specification expression indicating the lower bound of the dimension. The expression can have a positive, negative, or zero value. If necessary, the value is converted to integer type.

If the lower bound is not specified, it is assumed to be 1.

*

Is the upper bound of the last dimension.

The rank of the array is the number of explicit-shape specifications plus 1.

The size of the array is assumed from the actual argument associated with the assumed-size dummy array as follows:

  • If the actual argument is an array of type other than default character, the size of the dummy array is the size of the actual array.

  • If the actual argument is an array element of type other than default character, the size of the dummy array is a + 1 - s, where s is the subscript order value and a is the size of the actual array.

  • If the actual argument is a default character array, array element, or array element substring, and it begins at character storage unit b of an array with n character storage units, the size of the dummy array is as follows:

     MAX(INT((n + 1 - b)/y), 0)

    The y is the length of an element of the dummy array.

An assumed-size array can only be used as a whole array reference in the following cases:

  • When it is an actual argument in a procedure reference that does not require the shape

  • In the intrinsic function LBOUND

Because the actual size of an assumed-size array is unknown, an assumed-size array cannot be used as any of the following in an I/O statement:

  • An array name in the I/O list

  • A unit identifier for an internal file

  • A runtime format specifier

Examples

The following is an example of an assumed-size specification:

  SUBROUTINE SUB(A, N)
    REAL A, N
    DIMENSION A(1:N, *)
    ...

The following example shows that you can specify lower bounds for any of the dimensions of an assumed-size array, including the last:

  SUBROUTINE ASSUME(A)
    REAL A(-4:-2, 4:6, 3:*)

See Also