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

Pointer Association

A pointer can be associated with a target. At different times during the execution of a program, a pointer can be undefined, associated with different targets, or be disassociated. The initial association status of a pointer is undefined. A pointer can become associated by the following:

  • Pointer assignment (pointer => target)

    The target must be associated, or specified with the TARGET attribute. If the target is allocatable, it must be currently allocated.

  • Allocation (successful execution of an ALLOCATE statement)

    The ALLOCATE statement must reference the pointer.

A pointer becomes disassociated if any of the following occur:

  • The pointer is nullified by a NULLIFY statement.

  • The pointer is deallocated by a DEALLOCATE statement.

  • The pointer is assigned a disassociated pointer or the NULL intrinsic function.

  • The pointer is an ultimate component of an object of a type for which default initialization is specified for the component and one of the following is true:

    • A procedure is invoked with this object as an actual argument corresponding to a nonpointer, nonallocatable, dummy argument with INTENT (OUT).

    • A procedure is invoked with this object as an unsaved, nonpointer, nonallocatable local object that is not accessed by use or host association.

    • This object is allocated.

When a pointer is associated with a target, the definition status of the pointer is defined or undefined, depending on the definition status of the target. A target is undefined in the following cases:

  • If it was never allocated

  • If it is not deallocated through the pointer

  • If a RETURN or END statement causes it to become undefined

If a pointer is associated with a definable target, the definition status of the pointer can be defined or undefined, according to the rules for a variable.

The association status of a pointer becomes undefined when a DO CONCURRENT construct is terminated and the pointer's association status was changed in more than one iteration of the construct.

If the association status of a pointer is disassociated or undefined, the pointer must not be referenced or deallocated.

Whatever its association status, a pointer can always be nullified, allocated, or associated with a target. When a pointer is nullified, it is disassociated. When a pointer is allocated, it becomes associated, but is undefined. When a pointer is associated with a target, its association and definition status are determined by its target.

To see an example of Name, Pointer, and Storage Association, see Storage Association.

See Also