HP Fortran Programmer's Reference (September 2007)

Data types and data objects
Pointers
Chapter 5132
“Pointer assignment” on page 99 for information about associating a pointer with a target
by means of pointer assignment.
Chapter 10, “HP Fortran Statements” for a full description of the ALLOCATE and
DEALLOCATE statements as well as the POINTER and TARGET attributes.
The following section discusses pointer status and includes an example program.
Pointer association status
Certain pointer operations can only be performed depending on the status of the pointer. A
pointer’s status is called its association status, and it can take three forms:
Undefined The status of a pointer is undefined on entry to the program unit in which
the pointer is declared or if:
Its target is never allocated.
Its target was deallocated (except through the pointer.
The target goes out of scope, causing it to become undefined.
If the association status is undefined, the pointer must not be referenced or
deallocated. It may be nullified, assigned a target, or allocated storage with
the ALLOCATE statement.
Associated The status of a pointer is associated if it has been allocated storage with the
ALLOCATE statement or is assigned a target. If the target is allocatable, it
must be currently allocated.
If the association status is associated, the pointer may be referenced,
deallocated, nullified, or pointer assigned.
Disassociated The status of a pointer is disassociated if the pointer has been nullified with
the NULLIFY statement or deallocated, either by means of the DEALLOCATE
statement or by being assigned to a disassociated pointer.
If the association status is disassociated, the same restrictions apply as for a
status of undefined. That is, the pointer must not be referenced or
deallocated, but it may be nullified, assigned a target, or allocated storage
with the ALLOCATE statement.
You can use the ASSOCIATED intrinsic function to determine the association status of a
pointer; see Chapter 11, “Intrinsic procedures,” on page 501 for a description of this intrinsic.