Allocation status

The allocation status of an allocatable object is one of the following during program execution:
  • Not allocated, which means that the object has never been allocated, if it is given that status by the allocation transfer procedure, or that the last operation on it was a deallocation.
  • Allocated, which means that the object has been allocated by an ALLOCATE statement, if it is allocated during assignment, or if it is given that status by the allocation transfer procedure.
  • IBM extension begins Undefined, which means that the object does not have the SAVE or STATIC attribute and was allocated when execution of a RETURN or END statement resulted in no executing scoping units having access to it. In IBM® Open XL Fortran, undefined status is only available when you use the -qxlf90=noautodealloc option.

If the allocation status of an allocatable object is allocated, the object may be referenced and defined. An allocatable object that is not allocated must not be referenced or defined. If the allocation status of an allocatable object is undefined, the object must not be referenced, defined, allocated, or deallocated.

When the allocation status of an allocatable object changes, the allocation status of any associated allocatable object changes accordingly. Allocation of an allocatable variable establishes values for the deferred type parameters of all associated allocatable variables.

In the Fortran standard, the allocation status of an allocatable object that is declared in the scope of a module is processor-dependent if it does not have the SAVE attribute and was allocated when execution of a RETURN or END statement resulted in no executing scoping units referencing the module.

Fortran 2008 beginsAn unsaved, allocatable, local variable of a BLOCK construct is deallocated when execution exits the BLOCK construct.Fortran 2008 ends

In IBM Open XL Fortran, the allocation status of such an object remains allocated.