Intel® Fortran Compiler 16.0 User and Reference Guide

fprotect-parens, Qprotect-parens

Determines whether the optimizer honors parentheses when expressions are evaluated.

Syntax

Linux and OS X:

-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 expression evaluation.

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

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

IDE Equivalent

None

Alternate Options

None

Example

Consider the following expression:

A+(B+C)

By default, the parentheses are ignored and the compiler is free to re-order the operations based on the optimization level, the setting of option -fp-model (Linux* OS and OS X*) or /fp (Windows* OS), 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* OS and OS X*) or /Qprotect-parens (Windows* OS) 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* OS and OS X*) or /fp:precise (Windows* OS) to ensure precision because it controls all optimizations that may affect precision.

See Also