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

ID 767251
Date 9/08/2022
Public

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

Document Table of Contents

OPTIMIZE and NOOPTIMIZE

General Compiler Directive: Enables or disables optimizations for the program unit.

!DIR$ OPTIMIZE[: n]

!DIR$ NOOPTIMIZE

n

Is the number denoting the optimization level. The number can be 0, 1, 2, or 3, which corresponds to compiler options O0, O1, O2, and O3. If n is omitted, the default is 2, which corresponds to option O2.

The OPTIMIZE and NOOPTIMIZE directives can only appear once at the top of a procedure program unit. A procedure program unit is a main program, an external subroutine or function, or a module. OPTIMIZE and NOOPTIMIZE cannot appear between program units or in a block data program unit. They do not affect any modules invoked with the USE statement in the program unit that contains them. They do affect CONTAINed procedures that do not include an explicit OPTIMIZE or NOOPTIMIZE directive.

NOOPTIMIZE is the same as OPTIMIZE:0. They are both equivalent to −O0 (Linux* and macOS) and /Od (Windows*).

The procedure is compiled with an optimization level equal to the smaller of n and the optimization level specified by the O compiler option on the command line. For example, if the procedure contains the directive NOOPTIMIZE and the program is compiled with compiler option O3, this procedure is compiled at O0 while the rest of the program is compiled at O3.