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

ID 767251
Date 11/07/2023
Public

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

Document Table of Contents

CONTIGUOUS

Statement and Attribute: Specifies that the target of a pointer or an assumed-sized array is contiguous.

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

Type Declaration Statement:

type, [att-ls,] CONTIGUOUS [, att-ls] :: object [, object] ...

Statement:

CONTIGUOUS [::] object [, object] ...

type

Is a data type specifier.

att-ls

Is an optional list of attribute specifiers.

object

Is an assumed-shape array or an array pointer.

Description

This attribute explicitly indicates that an assumed-shape array is contiguous or that a pointer will only be associated with a contiguous object.

An entity can be contiguous even if CONTIGUOUS is not specified. An object is contiguous if it is one of the following:

  • An object with the CONTIGUOUS attribute

  • A nonpointer whole array that is not assumed-shape

  • An assumed-shape array that is argument associated with an array that is contiguous

  • An array allocated by an ALLOCATE statement

  • An pointer associated with a contiguous target

  • A nonzero-sized array section in which the following is true:

    • Its base object is contiguous.

    • It does not have a vector subscript.

    • The elements of the section, in array element order, are a subset of the base object elements that are consecutive in array element order.

    • If the array is of type character and a substring-range appears, the substring-range specifies all of the characters of the parent-string.

    • Only its final reference to a structure component, if any, has nonzero rank

    • It is not the real or imaginary part of an array of type complex.

An object is not contiguous if it is an array subobject, and all of the following are true:

  • The object has two or more elements.

  • The elements of the object in array element order are not consecutive in the elements of the base object.

  • The object is not of type character with length zero.

  • The object is not of a derived type that has no ultimate components other than zero-sized arrays and characters with length zero.

The CONTIGUOUS attribute can make it easier to enable optimizations that rely on the memory layout of an object occupying a contiguous block of memory.

Examples

The following examples show valid CONTIGUOUS statements:

REAL, CONTIGUOUS, DIMENSION(:,:) :: A
REAL, POINTER, CONTIGUOUS :: MY_POINTER(:)