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

ID 767251
Date 3/22/2024
Public

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

Document Table of Contents

Assumed-Rank Specifications

An assumed-rank array is a dummy argument whose rank is inherited from the actual argument associated with it, or it is the associate name of a RANK DEFAULT block of a SELECT RANK construct. It can have zero rank.

You declare an assumed-rank object (a dummy variable) by using DIMENSION(..) or (..)array bounds in its declaration.

Its rank is assumed from its effective argument, which means it is passed by descriptor.

An assumed-rank entity must not have the CODIMENSION or VALUE attribute. It can have the CONTIGUOUS attribute.

An assumed-rank variable name must not appear in a designator or expression except as one of the following:

  • An actual argument corresponding to a dummy argument that is assumed-rank

  • The argument of the C_LOC function in the ISO_C_BINDING intrinsic module

  • The first argument in a reference to an intrinsic inquiry function

  • The selector of a SELECT RANK construct

If an assumed-size or nonallocatable, nonpointer, assumed-rank array is an actual argument corresponding to a dummy argument that is an INTENT(OUT) assumed-rank array, it must not be polymorphic, finalizable, of a type with an allocatable ultimate component, or of a type for which default initialization is specified.

You can find the rank of an assumed-rank object by using the RANK intrinsic.

If a procedure has an assumed-rank argument, the procedure must have an explicit interface.

When an assumed-rank object is passed from Fortran to a BIND(C) routine, it is passed by C descriptor. A Fortran procedure that has the BIND(C) language-binding-spec attribute will also receive an assumed-rank object by C descriptor.

Examples

The following shows an assumed-rank object:

SUBROUTINE sub (foo, bar) 
! As sub does not have BIND, foo and bar are passed by "normal" descriptor
REAL, DIMENSION(..) :: foo
INTEGER :: bar(..)

INTERFACE
  SUBROUTINE csub (baz) BIND(C)
  REAL, DIMENSION(..) :: baz 
  END SUBROUTINE
END INTERFACE

CALL baz(foo)   ! Passed by C descriptor