Error : isnan, has not been explicitly declared

As part of my CFS code compilation using pgfortran, I am getting following error:

PGF90-S-0038-Symbol, isnan, has not been explicitly declared (coupler_module.f)

The method “isnan” is called inside file coupler_module.f
Is there an alternate method that I can use which is available in PGI libraries ?
PS: This method is available in Intel Compiler suite where this code builds fine.
This post is related to my earlier post with topic “Error when building with PGI compiler”.

Hi nikhilm,

“isnan” is a non-standard extension which we don’t support. Instead, you should use the standard F2003 elemental function “ieee_is_nan”. For example:

   use ieee_arithmetic
   do i=1,ncells
        write(nunit,'(F8.0)') -999.0
        write(nunit,'(F12.6)') var(i)

Hope this helps,

Hi Mat,
I have been using this equivalent ieee_is_nan method in my code from the beginning. Recently when I was revisiting the changes that I made to the code, it struck to me that since I am using an equivalent method “ieee_is_nan” in place of “isnan” it might be the reason behind those errors (repeated below):
Warning: ieee_invalid is signaling
Warning: ieee_divide_by_zero is signaling
Warning: ieee_underflow is signaling
Warning: ieee_inexact is signaling
Is there a way to circumvent this IEEE warning issue by using additional compiler options ? I have tried almost all possible combinations based on my limited understanding but of no help.

As an alternative, I downloaded and built a LAPACK library which provides “disnan” and “sisnan” (for double and single precision respectively) and tried using “disnan” in place of “isnan”. But it seems that I am not able to use the declaration for this method and get following error:
PGF90-S-0038-Symbol, disnan, has not been explicitly declared (coupler_module.f)
0 inform, 0 warnings, 1 severes, 0 fatal for set_data_init


Hi nikhilm,

To disable the F2003 IEEE Warnings issues being printed when a STOP statement is encountered, set the environment variable “NO_STOP_MESSAGE”. Though, any errors in your code will still be there, you just wont get the warnings. Also, if you had compiled the code with a non-F2003 standard compliant compiler, the warnings wont be there either, Hence, there is no telling if these are new or if they just showed up when F2003 is supported.

You can try trapping the floating-point exceptions with the “-Ktrap=fp” flag.

PGF90-S-0038-Symbol, disnan, has not been explicitly declared (coupler_module.f)
0 inform, 0 warnings, 1 severes, 0 fatal for set_data_init

LAPACK is a F77 library hence, you need to declare the functions before you can use them. Did you declare the “disnan” routine?

  • Mat

Hello Mat,
I was able to link the function “disnan” with LAPACK library that I downloaded and built independently. As you mentioned, I declared the function in the source code file and it worked.
But I am still getting the same type of IEEE warnings during execution. I verified that I am not using -Kieee flag during compilation or “use ieee_arithmatic” in my source code anywhere. This is somewhat puzzling to me.
Any suggestions on resolving this issue ?

Hi Nikhil,

The -Ktrap flag may be able to help. Adding “-Ktrap=fp” will abort the program anytime a floating-point exception is encountered. This coupled with running the code in a debugger, should give you a better idea as to what’s happening. Granted some of the exceptions may not matter, so you can restrict the flag to trap only certain types of exceptions. In particular, I’d look for the divide by zero, -Ktrap=divz.

Hope this helps,

Controls the behavior of the processor when exceptions occur. Possible options include

align Trap on memory alignment errors, currently ignored.

denorm Trap on denormalized operands.

divz Trap on divide by zero.

fp Trap on floating point exceptions.

inexact Trap on inexact result.

inv Trap on invalid operands.

none (default)
Disable all traps.

ovf Trap on floating point overflow.

unf Trap on floating point underflow.
-Ktrap is only processed when compiling a main function/program. -Ktrap=fp is equivalent to -Ktrap=divz,inv,ovf. These options
correspond to the processor’s exception mask bits. Normally, the processor’s exception mask bits are on, meaning floating-point
exceptions are masked; the processor recovers from the exception and continues. If a mask bit is off (unmasked) and the
corresponding exception occurs, execution terminates with floating point exception (Linux FPE signal).