Handle Fortran Array Descriptors

For cases where Standard Fortran needs to keep track of more than a pointer memory address, the Intel® Fortran Compiler uses an array descriptor, which stores the details of how an array is organized.

When using an explicit interface (by association or procedure interface block), the compiler generates a descriptor for the following types of array arguments:

Certain types of arguments do not use a descriptor, even when an appropriate explicit interface is provided. For example, explicit-shape and assumed-size arrays do not use a descriptor. In contrast, array pointers and allocatable arrays use descriptors regardless of whether they are used as arguments.

When calling between Intel® Fortran and C/C++, use an implicit interface, which allows the array argument to be passed without an Intel® Fortran descriptor. However, for cases where the called routine needs the information in the Intel® Fortran descriptor, declare the routine with an explicit interface and specify the dummy array as either an assumed-shape array or with the pointer attribute.

Note

The information in the remainder of this section is specific to Intel® Fortran, and subject to change in future releases. For information on how to interoperate with C and array descriptors in a portable and standard fashion, see C Structures, Typedefs, and Macros for Interoperability.

You can associate a Fortran array pointer with any piece of memory, organized in any way desired (as long as it is "rectangular" in terms of array bounds). You can also pass Fortran array pointers to the C language, and have it correctly interpret the descriptor to obtain the information it needs.

The downside to using array descriptors is that it can increase the opportunity for errors. Additionally, the corresponding code is not portable. Specifically:

The components of the current Intel® Fortran array descriptor are as follows:

An array of rank one requires three additional 8-byte entities for a total of nine 8-byte entities (6 + 3*1) and ends at byte 71. An array of rank seven is described in a total of twenty-seven 8-byte entities (6 + 3*7) and ends at byte 215. Consider the following declaration:

  integer,target  :: a(10,10)
  integer,pointer :: p(:,:)
  p => a(9:1:-2,1:9:3)
  call f(p)
...

The descriptor for actual argument p would contain the following values: