0

On Linux (Ubuntu 16.04, kernel 4.4.0-186-generic), I used the Fortran compiler sunf95 from Oracle Developer Studio 12.6 to compile the following Fortran code:

program testieee
    use ieee_arithmetic, only : is_nan => ieee_is_nan
    implicit none
    print *, is_nan(0.0)
end program testieee

No compiler option was specified. The compilation failed with the following message:

f90comp: ../src/s_intr_mod.c :772 : ieee_arithmetic_semantics: assertion `0' failed.
f90: Fatal error in $PATH_TO_ORACLE_DEVELOPER_STUDIO/OracleDeveloperStudio12.6-linux-x86-bin/developerstudio12.6/lib/compilers/bin/f90comp : Signal number = 6

However, the following code can be compiled successfully using the same compiler:

program testieee
    use ieee_arithmetic, only : ieee_is_nan  ! Here is the only difference.
    implicit none
    print *, ieee_is_nan(0.0)
end program testieee

Both versions of the code can be compiled without any problem by gfortran, g95, ifort, nagfor, pgfortran, and absoft fortran compilers.

So why did Oracle Developer Studio 12.6 fail? What does the error message mean? Any comments/criticism on the code will be appreciated. Thank you very much.

Edit

  • As speculated by @Ian Bush, the error might be because the name "is_nan" conflicted with that of some nonstandard intrinsic procedure. So I tried changing it to "my_nan", but the error persisted. Thanks to Ian Bush.
Nuno
  • 256
  • 1
  • 11
  • 3
    The error message almost certainly is due to a bug in the compiler. An assertion failure is usually due to something happening which should be impossible. Complete guess: the compiler provides a non-standard intrinsic function is_nan which is in some way getting confused with your renamed version of ieee_is_nan. Is there a compiler flag to turn off the use of non-standard intrinsics? Does adding the flag which requires conformance to fortran 2003 do anything? If you rename it to my_nan rather than is_nan does it work? – Ian Bush Aug 10 '20 at 19:04
  • Thank you for the comments, @Ian Bush. I changed "is_nan" to "my_nan", the failure persisted. Thus the name "is_nan" is not the source of the problem. The compiler seems to have no option to require f2003 conformance (I did not find such an option in https://docs.oracle.com/cd/E77782_01/pdf/E77790.pdf). Thanks again. – Nuno Aug 11 '20 at 01:13
  • Anyway, a compiler crash is a bug in the compiler: a compiler shall not crash, whatever the input, but either compile or print an error message telling why the source code is not valid. You should file a bug report. –  Aug 13 '20 at 11:52
  • Thanks. Done, but no response. – Nuno Aug 13 '20 at 16:42

0 Answers0