Deferred-shape arrays
Deferred-shape arrays are allocatable arrays or array pointers, where the bounds can be defined or redefined during execution of the program.
Deferred_shape_spec_list
.-,-. V | >>---:-+-------------------------------------------------------><
The extent of each dimension (and the related properties of bounds, shape, and size) is undefined until the array is allocated or the pointer is associated with an array that is defined. Before then, no part of the array may be defined, or referenced except as an argument in certain situations.
- pointer assignment
- ALLOCATE statement
- if it is a dummy argument, argument association with a non-pointer actual argument or an associated pointer argument
- ALLOCATE statement
- if it is a dummy argument, argument association with an allocated argument
The rank is the number of colons in the deferred_shape_spec_list.
Although a deferred_shape_spec_list can appear identical to an assumed_shape_spec_list, deferred-shape arrays and assumed-shape arrays are not the same. A deferred-shape array must have the ALLOCATABLE or POINTER attribute, while an assumed-shape array must be a dummy argument that does not have the ALLOCATABLE or POINTER attribute. The bounds of a deferred-shape array, and the actual storage associated with it, can be changed at any time by reallocating the array or by associating the pointer with a different array, while these properties remain the same for an assumed-shape array during the execution of the containing subprogram.