Supported Fortran 2003 features?

Hello,

I could not find whether any Fortran 2003 features are already supported by the PGI Fortran compiler, and if yes, which. As both GCC’s gfortran as also Intel’s ifort support some Fortran 2003 features, some of them have been accumulated in our programs.

Fortran 2003 contains nice features such as:

  • Floating point exception handling [TR ISO/IEC 15580:1998(E)]
  • Allocatable arrays as structure components, dummy arguments, and function results [TR ISO/IEC 15581: 1998(E)]
  • parameterized derived types
  • Commandline/Environment intrinsic procedures
  • Binary/octal/hex constants
  • Better C interoperability

Tobias

Hi Tobias,

While we do not yet support F2003, we will start to add portions of the new standard later this year. Which of the new features are you most interested in?

  • Mat

Which of the new features are you most interested in?

Well, these handy functions/constants, which should be trivial to implement,
which finally remove the problem of having no commandline arguments or having one method per compiler (currently I use “f2kcli” for those compiler, which don’t support it yet):

  • These intrinisc subroutines: COMMAND_ARGUMENT_COUNT, GET_COMMAND_ARGUMENT, GET_COMMAND, GET_ENVIRONMENT_VARIABLE

  • The intrinsic module ISO_FORTRAN_ENV
    This allows for WRITE(ERROR_UNIT,) which is simply more readable than WRITE(0,).

Plus some real stuff:

Tobias

Hello!

The fortran 95 standard has extensions defined in ISO/IEC TR 15581 (issued in 2001), even before the 2003 fortran, which are VERY desirable.

In particular we would like allocatable dummy arrays and allocatable functions. Test code for these two features can be found in the files ch2801.f90 and ch2802.f90, which can be downloaded from the web page http://www.kcl.ac.uk/kis/support/cit/fortran/f2003_book_examples/index.html

Would you guys at Portland be able to implement these features in the near future?

We are in the middle of a large joint development project and a lot of teams are pushing towards Lahey-Fujitsu because it does allow these extensions, while pgf95 does not.

Cheers,
emilia






We are considering buying your compiler to help us port our codes to it for one of our partners. We have been using Intel Visual Fortran and the 2003 feature that allows allocation of derived-type components features heavily in our codes. Without that feature, we won’t be able to use your compiler.

We use command-line arguments a lot and need the new intrinsics. We can work around this, but would prefer not to. It is not a deal breaker.

A problem I have seen with some compilers is that they would not let me invoke a function in an output statement if the function did any internal I/O. They would flag it as recursive I/O. I have many hundreds of lines of code in many programs that do this. This, too, would be a deal breaker for us. I don’t know if this is a 2003 feature. It seems to be a compiler bug to me.

A posted list of adopted 2003 features would be very helpful.

I’m primarily a Windows user and if I port our codes to your compiler for our partners, I’d be more comfortable working in the Windows environment. If all your Fortran compiler have the same language features, then that would make my job easier.

Do they?

Hi,

We have user asks for this at:
https://forums.developer.nvidia.com/t/fortran-extensions/130931/1

Here is a list:

• Fortran 2003 ISO_C_BINDING – The ISO_C_BINDING module is partially implemented. The BIND attribute is supported for derived types and constant kind definitions are provided that map to C types. For procedures, the VALUE and BIND attributes are supported, as well as the BIND attribute for global data. The procedure C_LOC is supported, which returns the C address of an object. Other procedures in ISO_C_BINDING, such as C_ASSOCIATED, are not yet implemented.

• Fortran 2003 Allocatable Regularization – Fortran 2003 allocatable regularization is implemented in PGF95 and is always enabled. These changes allow allocatable arrays to be passed as dummy arguments, to be returned from functions, and to be components of derived types.

• Fortran 2003 Allocatable Array Assignment – Fortran 2003 allocatable array assignment is available in PGF95. The default is to use the Fortran 95 assignment semantics; however, the option -Mallocatable=03 enables the Fortran 2003 assignment semantics.

• Fortran 2003 Asynchronous Input/Output – Fortran 2003 asynchronous I/O is partially implemented in PGF77 and PGF95 compilers. For external files opened with ASYNCHRONOUS='YES in the OPEN statement, asynchronous I/O is allowed for external files opened with ASYNCHRONOUS=‘YES’ in the OPEN statement. Asynchronous I/O operations are indicated by ASYNCHRONOUS=‘YES’ in READ and WRITE statements. The compilers do not implement the ASYNCHRONOUS attribute or ASYNCHRONOUS statement.

• Fortran 2003 Stream Input/Output – Fortran 2003 Stream access I/O is implemented.

• –Mallocatable=[95|03] – The –Mallocatable option controls how the compiler treats assignment of allocatables. The default behavior is to use Fortran 95 semantics; the 03 option instructs the compiler to use Fortran 2003 semantics.


We are going to put it up in FAQ soon.

Thank you,
Hongyon