IEEE_UNDERFLOW_FLAG IEEE_DENORMAL in Fortran 77

Robert picture Robert · Jun 1, 2017 · Viewed 22.8k times · Source

I am new to Fortran and coding in general so I apologize if my terminology is not correct.

I am using a Linux machine with the gfortran compiler.

I am doing research this summer which involves me getting a program written in about 1980 working again. It is written in Fortran 77. I have all the code as well as some documentation about it.

In its current form it I am receiving a "IEEE_UNDERFLOW_FLAG IEEE_DENORMAL" error. My first thought is that this code was meant to be developed under a different environment/architecture.

The documentation states “This program was designed to run on the HARRIS computer system. It also can be run on VAX system if the single precision variables are changed into double precision variables both in the main code and the subroutine package.”

I have tried changing the single precision variables to double precision variables, but I may have done that wrong. If this is the correct thing to do any insight would be great.

I have also tried compiling the coding with -std=legacy and -m32. I receive the same error from this as well.

Any advice to get me going in the right direction would be greatly appreciated.

Answer

Vladimir F picture Vladimir F · Jun 1, 2017

"IEEE_UNDERFLOW_FLAG IEEE_DENORMAL is signalling" is not that uncommon. It is NOT an error message.

The meaning is that there are denormal numbers generated when running the code.

It may be a hint about numerical problems in your code, but it is not an error per se. Probably it means that your program finished successfully.

Fortran in its latest edition requires that all floating point exceptions that are signalling be reported when a STOP statement is executed. See gfortran IEEE exception inexact BTW, that also means that your program is not being compiled as Fortran 77 but as Fortran 2003 or higher.

Note that even if you request the Fortran 95 standard by -std=f95 the note is still displayed, but it can be controlled by the -ffpe-summary=list flag.

The linked answer also says that a way to avoid these warnings is to not finish the program by a STOP statement, but by running till the END PROGRAM. If you have something like

STOP
END

or

STOP
END PROGRAM

in your code, just remove the STOP, it is useless, if not even harmful.

You may but you don't have to be successful in getting rid of that by using double precision. If there are numerical problems in the algorithms, they will stay there even with doubles. But they may become less apparent. Or they might not, it depends. You don't have to re-write your code for that, just use -fdefault-real-8 or -freal-4-real-8 or similar. Read more about these options in your gfortran manual. You could even try quadruple precision, but double should normally be sufficient for all reasonable algorithms.