Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

auto-scalar, Qauto-scalar

Causes scalar variables of intrinsic types INTEGER, REAL, COMPLEX, and LOGICAL that do not have the SAVE attribute to be allocated to the runtime stack.

Syntax

Linux:

-auto-scalar

macOS:

-auto-scalar

Windows:

/Qauto-scalar

Arguments

None

Default

-auto-scalar or /Qauto-scalar

Scalar variables of intrinsic types INTEGER, REAL, COMPLEX, and LOGICAL that do not have the SAVE attribute are allocated to the runtime stack.

Note that the default changes to option auto if one of the following options are specified:

  • recursive

  • [q or Q]openmp

Description

This option causes allocation of scalar variables of intrinsic types INTEGER, REAL, COMPLEX, and LOGICAL to the runtime stack. It is as if they were declared with the AUTOMATIC attribute.

It does not affect variables that have the SAVE attribute (which include initialized locals) or that appear in an EQUIVALENCE statement or in a common block.

This option may provide a performance gain for your program, but if your program depends on variables having the same value as the last time the routine was invoked, your program may not function properly. Variables that need to retain their values across subroutine calls should appear in a SAVE statement.

You cannot specify option save or auto with this option.

NOTE:

On Windows NT* systems, there is a performance penalty for addressing a stack frame that is too large. This penalty may be incurred with [Q]auto because arrays are allocated on the stack along with scalars. However, with /Qauto-scalar, you would have to have more than 32K bytes of local scalar variables before you incurred the performance penalty. /Qauto-scalar enables the compiler to make better choices about which variables should be kept in registers during program execution.

IDE Equivalent

Visual Studio: Data > Local Variable Storage (/Qsave, /Qauto, /Qauto_scalar)

Alternate Options

None

See Also