Intel® Fortran Compiler

Developer Guide and Reference

ID 767251
Date 10/15/2026
Public
Document Table of Contents

fopenmp-optimistic-collapse

Tells the compiler to use at most 32 bits for the iteration variable of a loop nest collapsed by an OpenMP* collapse clause.

Syntax

Linux:

-fopenmp-optimistic-collapse

Arguments

None

Default

OFF

If the trip counts of the collapsed loops are not known at compile time, the compiler uses a 64-bit iteration variable for the collapsed loop nest.

Description

When the trip counts of the loops in a collapsed loop nest are not known at compile time, the compiler extends the iteration variable of the collapsed loop nest to 64 bits so that the total iteration count cannot overflow. This option prevents this conservative choice and tells the compiler to use at most 32 bits, which can reduce the overhead of computing loop indices.

This option affects only loops whose counters are 32 bits or narrower, such as int. It takes effect only when OpenMP* is enabled by option -qopenmp, -fiopenmp, or -fopenmp.

CAUTION:

Specify this option only if the total number of iterations of every collapsed loop nest in the compilation fits in a 32-bit signed integer (at most 2,147,483,647). Otherwise, the program may silently produce incorrect results.

IDE Equivalent

None

Alternate Options

None

Examples

The following tells the compiler to use a 32-bit iteration variable for collapsed loop nests in an OpenMP* CPU compilation:

icx -qopenmp -fopenmp-optimistic-collapse foo.c

The following specifies the option with offload compilation. The option applies to both the host code and the device code:

icpx -qopenmp -fopenmp-targets=spir64 -fopenmp-optimistic-collapse bar.cpp

See Also