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

ID 767251
Date 11/07/2023
Public

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

Document Table of Contents

fprotect-parens, Qprotect-parens

Determines whether the optimizer honors parentheses when floating-point expressions are evaluated.

Syntax

Linux:

-fprotect-parens

-fno-protect-parens

Windows:

/Qprotect-parens

/Qprotect-parens-

Arguments

None

Default

-fno-protect-parens
or /Qprotect-parens-

Parentheses are ignored when determining the order of expression evaluation.

Description

This option determines whether the optimizer honors parentheses when determining the order of floating-point expression evaluation.

When option -fprotect-parens (Linux*) or /Qprotect-parens (Windows*) is specified, the optimizer will maintain the order of evaluation imposed by parentheses in the code.

When option -fno-protect-parens (Linux*) or /Qprotect-parens- (Windows*) is specified, the optimizer may reorder floating-point expressions without regard for parentheses if it produces faster executing code.

IDE Equivalent

None

Alternate Options

Linux: -assume protect_parens

Windows: /assume:protect_parens

Example

Consider the following expression:

A+(B+C)

By default, the parentheses are ignored and the compiler is free to re-order the floating-point operations based on the optimization level, the setting of option -fp-model (Linux*) or /fp (Windows*), etc. to produce faster code. Code that is sensitive to the order of operations may produce different results (such as with some floating-point computations).

However, if -fprotect-parens (Linux*) or /Qprotect-parens (Windows*) is specified, parentheses around floating-point expressions (including complex floating-point and decimal floating-point) are honored and the expression will be interpreted following the normal precedence rules, that is, B+C will be computed first and then added to A.

This may produce slower code than when parentheses are ignored. If floating-point sensitivity is a specific concern, you should use option -fp-model precise (Linux*) or /fp:precise (Windows*) to ensure precision because it controls all optimizations that may affect precision.

See Also