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

ID 767251
Date 6/24/2024
Public

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

Document Table of Contents

CODIMENSION

Statement and Attribute: Specifies that an entity is a coarray, and specifies its corank and cobounds, if any.

The CODIMENSION attribute can be specified in a type declaration statement or a CODIMENSION statement, and takes one of the following forms:

Type Declaration Statement:

type, [att-ls,] CODIMENSION [coarray-spec] :: var-list [(array-spec)]...

type, [att-ls,] var-list [(array-spec)] [coarray-spec]...

Statement:

CODIMENSION [::] var-list [coarray-spec]...

type

Is a data type specifier.

att-ls

Is an optional list of attribute specifiers.

coarray-spec

Is an allocatable (deferred-coshape) coarray or an explicit-coshape coarray.

var-list

Is a list of variable names, separated by commas.

Description

In Intel® Fortran, the sum of the rank and corank of an entity must not exceed 31. The Fortran 2018 Standard allows a combined rank of up to 15.

A coarray must be a component or a variable that is not a function result.

A coarray must not be of type C_PTR or C_FUNPTR from the intrinsic module ISO_C_BINDING or of type TEAM_TYPE from the intrinsic module ISO_FORTRAN_ENV.

An entity whose type has a coarray ultimate component must be a nonpointer nonallocatable scalar, must not be a coarray, and must not be a function result.

A coarray or an object with a coarray ultimate component must be an associate name, a dummy argument, or have the ALLOCATABLE or SAVE attribute.

A coarray must not be a dummy argument of a procedure that has a BIND attribute.

A coarray can be a derived type with pointer or allocatable components. The target of such a pointer component is always on the same image as the pointer.

Examples

Explicit-shape coarrays that are not dummy arguments must have the SAVE attribute. Because of this, automatic coarrays are not allowed. For example, coarray TASK in the following code is not valid:

SUBROUTINE SUBA(I,C,D)
INTEGER :: I
REAL :: C(I)[*], D(I)
REAL :: TASK(I)[*]        ! Not permitted

The following lines show valid examples of CODIMENSION attribute specifications:

REAL, CODIMENSION[3,*] :: B(:)   ! Assumed-shape coarray
REAL R(50,50)[0:5,*]             ! Explicit-shape coarray
REAL, CODIMENSION[*] :: A        ! Scalar coarray
REAL, CODIMENSION[:],ALLOCATABLE :: C(:,:)  ! Allocatable coarray