In Fortran, an automatic object is a local variable in a procedure whose bounds or length are determined, in whole or in part, by a dummy argument, common variable, or use or host-associated variable. These variables are allocated when the procedure is entered and deallocated when the procedure exits.
The SAVE attribute specifies that a variable must retain its definition status across calls to a procedure. This is not compatible with automatic objects. For example:
subroutine sub (n) integer a(n) save a end
Here, a is an automatic array whose bounds are determined by the dummy variable n. This could be different on each call to sub. The SAVE statement, or SAVE attribute, is not allowed here, and will cause the compiler to give error #6754.
It is possible to have an array with run-time bounds saved across procedure calls if it is ALLOCATABLE. For example, this would be allowed:
subroutine sub (n) integer, allocatable, save :: a(:) if (.not. allocated(a)) allocate(a(n)) end
In this example, array a would be allocated the first time sub was called to dimension n, and then the bounds (and values in the array) would remain defined across calls. Subsequent calls with different values of n would not change the allocation.