Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29426 Discussions

Switches to get full standard conformance

MR
Beginner
823 Views
Hi all, I wonder whether there is a list of all the switches that should be used to get full standard conformance for a given standard. I know about -assume realloc_lhs and I just discovered (after a few hours debugging!) -assume noold_maxminloc. It would be nice to have a checklist to go through when getting unexpected behavior. Thank you, Marco Restelli
0 Kudos
5 Replies
Steven_L_Intel1
Employee
823 Views
See the table at the bottom ofIntel Fortran Compiler - Support for Fortran language standards

In a future release, there will be a single switch to get you all of these.
0 Kudos
MR
Beginner
823 Views
OK, thank you.
0 Kudos
TimP
Honored Contributor III
823 Views
-assume protect_parens is required for compatibility with any of the earlier Fortran standards. It would prevent algebraic simplifications which violate parentheses. In my experience, it's the most important of these switches, when considering source code which doesn't exploit f2003 features. noprotect_parens (the default) doesn't consistently maintain performance.
-assume minus0 is required for compatibility with fortran 95 as well as later standards. In current compilers, it should improve optimization.

I try to remember to copy several of these options into ifort.cfg each time I install ifort for my own use.

-assume dummy_aliases is important for code which doesn't comply with Fortran standard, but it may seriously degrade optimization. Unfortunately, a great deal of legacy code is written with such problems; even people who are aware of the issue sometimes assert that the compiler shouldn't break code where "obviously" there is nothing to gain by requiring standard compliance, or "none of the classic supercomputer compilers ever broke here."

I find it difficult to remember which of these options default to non-standard, and wish that some of those defaults would change. I thank Steve for the plan to provide a single standardization option.
0 Kudos
MR
Beginner
823 Views
Tim, thank you for elaborating on this. My goal is to have full fortran 2003 compliant code, even at the expense of some optimization (although it's good to know which options can be used, occasionally, to get it the other way around: best optimization at the expense of standard conformance). So my understanding is that, using the flags listed at the web page indicated by Steve's post, I should get the fortran 2003 standard. One thing I am not sure about is -assume protect_parens: from the web page it seems that it is required for fortran 2003, while from your post I understand that it's only required for earlier standards, but not for fortran 2003, and that it can degrade performance. How does it work? Thank you (and I also agree that having a single flag, somewhat similar to -stand f03, would be very nice)! Marco
0 Kudos
Steven_L_Intel1
Employee
823 Views
-assume protect_parens is required to get conformance to all revisions of the standard. Without that, the optimizer may rearrange expressions ignoring parentheses. For example, if you have:

(a + b) + (c - d)

the compiler might choose to evaluate

a + (b + c) - d

without the option, if it thinks performance would be better.
0 Kudos
Reply