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:
By 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.
By 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).
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.
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.