IEEE Fortran module

Gfortran happily compiles and runs the 3-line program below (printing T T) but ifort refuses to compile it. Is the bug in my program, or in one of the compilers?

  use,intrinsic:: ieee_arithmetic, only: ieee_support_standard
  print *, [ ieee_support_standard(1e0), ieee_support_standard(1d0) ]
  end program

This is what ifort -V said about it:

Compiling "ifort -V ieeeproblem.f90"
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.8.0 Build 20221119_000000
Copyright (C) 1985-2022 Intel Corporation.  All rights reserved.

 Intel(R) Fortran 2021.8.0-1196
ieeeproblem.f90(3): error #6259: This array or function or substring is invalid 
in constant expressions.   [IEEE_SUPPORT_STANDARD]
  ieeeok = [ ieee_support_standard(1e0), ieee_support_standard(1d0) ]
-------------^
ieeeproblem.f90(3): error #6259: This array or function or substring is invalid 
in constant expressions. [IEEE_SUPPORT_STANDARD]
  ieeeok = [ ieee_support_standard(1e0), ieee_support_standard(1d0) ]
-----------------------------------------^
compilation aborted for ieeeproblem.f90 (code 1)
1 Like

Intel Fortran does not conform in this case.

This is similar to a couple of other cases that have been discussed at this discourse in the recent past and support requests have been submitted with Intel to enhance their processor.

You may want to post this at the Intel Fortran forum so their support team can add it to their other requests and thus get their compiler staff to get a broader view of the problem.

Intel Fortran compiler developers will need to look closely at both 10.1.11 and 10.1.12 sections in the Fortran standard on specification and constant expressions respectively and review the specification inquiry semantics where each primary is a constant expression for use with constant expressions such as with array constructors, structure constructors, etc. for a through resolution toward standard conformance.

2 Likes

Out of curiosity, have you tried the newer ifx compiler from Intel?

This is another case, as @FortranFan suggests, of the Intel compiler not allowing “specification inquiry” functions in constant expressions. ifx behaves the same. It’s even worse than the earlier reported behavior ( Solved: Inquiry function warnings for -stand flag - Intel Communities) in that this is an error, not just a standards warning.

Thank you Fortran Fan and Sblionel. Now to try and revive my membership of the Intel Fortran forum which didn’t accept my old password and when I tried the “forgotten password” option I was sent an
unreadable email.