Why is Standard Fortran not Standard Default behavior in Intel Compiler?

Why is Standard Fortran not Standard Default behavior in Intel Compiler?

I have been wasting time for hours trying to understand why my code does not work, the way it should as the Fortran standard says. and finally I realized Intel Fortran compiler does not provide automatic reallocation by default, as it was introduced in Fortran 2003 Standard. According to this page:

https://software.intel.com/en-us/articles/error-variable-not-allocated-a...

one has to use the compilation flag /assume:realloc_lhs to get the "default" behavior as one should in modern Fortran. Why is there so much drag to follow the new Fortran standards? It is now a decade and half since this feature was introduced and yet one has to explicitly request the compiler to recognize the new Fortran stanard. Thanks for any reasonable explanation, and permanent fix to this problem, if there is any.

I am using:  Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.0.108 Build 20140726
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

 

9 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

If you have standards checking (/stand) to f03 or higher than you get  /assume:realloc_lhs automatically I believe. Ifort does it this wway as otherwise old code that conformed to f95 would/could break.

If you use a more recent compiler, such as the current 17.0.4, /assume:realloc_lhs is the default. Earlier versions did what you described, and I remember reading discussions of what the default should be.

Please see https://software.intel.com/en-us/node/678232 .

Thank you for your answers. I think this could also explain the random behaviors that I have seen on different devices with different Intel compiler versions.

The flag you need to use is /standard-semantics. Use it, always.

The Fortran 2003 behaviour does not break conforming Fortran 95 programs, but it may have a slight performance impact.

Thank you Ian. Is the performance hit you mentioned specific to parts of the codes that use the new >2003 standard features, or is it broader? For example, if I compile a F90 code with F03 syntax enabled, would it perform worse than when F03 syntax is disabled? My own naive answer would be "no".

/standard-semantics definitely does break some f95-conforming programs, but usually this is due to a change from one valid implementation choice to another. You have to get creative to compose a program that is guaranteed to behave differently between f95 and f2003.

 

In a few isolated cases, performance of f2003 compliant compilation is well below f95. One such is vectorizable sum and dot product reduction.

Citação:

andrew_4619 escreveu:

If you have standards checking (/stand) to f03 or higher than you get  /assume:realloc_lhs automatically I believe. Ifort does it this wway as otherwise old code that conformed to f95 would/could break.

/stand does not affect this. You are correct that defaulting to current standard behavior across the board would break many existing programs. All of these cases are where earlier standards did not specify behavior and left it up to implementations. Over the years, The DEC/Compaq/Intel compilers did change defaults where it could without breaking many programs or severely impacting performance. 

Steve (aka "Doctor Fortran") - Retired from Intel

Leave a Comment

Please sign in to add a comment. Not a member? Join today