Intel® Fortran Compiler 17.0 Developer Guide and Reference
Determines whether the optimizer honors parentheses when expressions are evaluated.
Linux and macOS: | -fprotect-parens -fno-protect-parens |
Windows: | /Qprotect-parens /Qprotect-parens- |
None
-fno-protect-parens |
Parentheses are ignored when determining the order of expression evaluation. |
This option determines whether the optimizer honors parentheses when determining the order of expression evaluation.
When option -fprotect-parens (Linux* and OS X*) or /Qprotect-parens (Windows*) is specified, the optimizer will maintain the order of evaluation imposed by parentheses in the code.
When the option -fno-protect-parens (Linux* and OS X*) or /Qprotect-parens- (Windows*) is specified, the optimizer may reorder expressions without regard for parentheses if it produces faster executing code.
Linux and OS X: -assume protect_parens
Windows: /assume:protect_parens
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* and OS X*) 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* and OS X*) 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* and OS X*) or /fp:precise (Windows*) to ensure precision because it controls all optimizations that may affect precision.