The AUTOMATIC attribute specifies that a variable has a storage class of automatic; that is, the variable is not defined once the procedure ends.
If automatic is a function result it must not be of type character or of derived type.
Function results that are pointers or arrays, dummy arguments, statement functions, automatic objects, or pointees must not have the AUTOMATIC attribute. A variable with the AUTOMATIC attribute cannot be defined in the scoping unit of a module or submodule. A variable that is explicitly declared with the AUTOMATIC attribute cannot be a common block item.
A variable must not have the AUTOMATIC attribute specified more than once in the same scoping unit.
Any variable declared as AUTOMATIC within the scope of a thread's work will be local to that thread.
A variable with the AUTOMATIC attribute cannot be initialized by a DATA statement or a type declaration statement.
If automatic is a pointer, the AUTOMATIC attribute applies to the pointer itself, not to any target that is (or may become) associated with the pointer.
ALLOCATABLE 1 | CONTIGUOUS 2 | VOLATILE |
ASYNCHRONOUS | POINTER | |
DIMENSION | TARGET | |
Note:
|
CALL SUB
CONTAINS
SUBROUTINE SUB
INTEGER, AUTOMATIC :: VAR
VAR = 12
END SUBROUTINE ! VAR becomes undefined
END