11

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.

Robert
  • 111
  • 1
  • 1
  • 3
  • Production of subnormal is probably to be expected. It would not indicate a problem in your choice of build procedure. – tim18 Jun 01 '17 at 13:27
  • The instruction about switching to double precision may be important, as the properties of ieee754 single may not be better than vax. – tim18 Jun 01 '17 at 13:30
  • Gfortran has options for automatic replacement of single by double. You should read the docs if considering this. – tim18 Jun 01 '17 at 13:32

1 Answers1

18

"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.

  • not "at the end" , but only on encountering `STOP` right? So if the code terminates normally with a `STOP ; END ` removing the `STOP` should fix. (?) – agentp Jun 01 '17 at 15:51
  • Yes, that is the conclusion of the linked answer. I should stress that here too. – Vladimir F Героям слава Jun 01 '17 at 15:52
  • @VladimirF I am not sure if this could be causing an error, after reading more about the HARRIS system it looks like the code was developed on a 48-bit computer. Also, the way I have read the gfortran manual, it is not possible to compile my program as Fortran 77, is that correct? Thanks for all your help so far. – Robert Jun 01 '17 at 18:44
  • Does it say warning or error before the "EEE_UNDERFLOW_FLAG IEEE_DENORMAL"? With respect to your project, you will need a way to validate that the code is running as intended, and whether it is correct or not is a harder problem. You may want a strategy for how you approach that, which is usually one subroutine or function at a time. – Holmz Jun 02 '17 at 01:46
  • @Robert I stress again that the message is not an error message, just a piece of information for you. It is up to you what you do with such information. You are correct that you cannot compile your code as Fortran 77 with gfortran or any other modern Fortran compiler. Fortran 77 is hopelessly old and obsolete and more recent revisions of the standard are mostly backward compatible. (After 5 years this is mostly a clarification for other readers.) – Vladimir F Героям слава Jan 11 '23 at 08:22