INITAUTO

The INITAUTO option directs the compiler to add an INITIAL attribute to any AUTOMATIC variable declared without an INITIAL attribute.

Read syntax diagramSkip visual syntax diagram
   .-NOINITAUTO--------------------.   
>>-+-INITAUTO--+-----------------+-+---------------------------><
               |    .-FULL--.    |     
               '-(--+-SHORT-+--)-'     

Under INITAUTO(FULL), the compiler adds an INITIAL attribute to any AUTOMATIC variable that does not have an INITIAL attribute according to its data attributes:

The compiler will not add an INITIAL attribute to variables with other attributes.

INITAUTO will cause more code to be generated in the prologue for each block containing any AUTOMATIC variables that are not fully initialized (but unlike the DFT(INITFILL) option, those variables will now have meaningful initial values) and will have a negative impact on performance.

The INITAUTO option does not apply an INITIAL attribute to any variable declared with the NOINIT attribute.

Under INITAUTO(SHORT), the compiler adds an INITIAL attribute to an AUTOMATIC variable that does not have an INITIAL attribute only if it is also a scalar and has one of the following attributes:

As under INITAUTO(FULL), the added INITIAL attribute will be appropriate to the data type.

If you are using the runtime STORAGE option to zero-out all storage, the optimizer might still generate undesired code for uninitialized AUTOMATIC variables and especially for those that are optimized to registers. Scalar variables with the data types listed above are those most likely to be optimized to registers, and hence using INITAUTO(SHORT) might have less of a performance impact than using DFT(INITFILL); however, the latter would leave the optimizer with no ambiguous code. Moreover, your code is correct only if all variables are explicitly initialized before use.