Interpreting gforran tracebackback

I am running a Fortran 77 program written by someone else. I am using the gfortran compiler (v5.4.0) for Linux (Ubuntu v.16.04). I am not an experienced Fortran, gcc or bash scripting user, so I'm afraid here.

When my program exits, I get the following message:

Note: The following floating-point exceptions are signalling: IEEE_DENORMAL

I had to see this - I understand that some of my floating-point numbers need to be stored in a "denormal", low-precision format for very small numbers (rather than dropping them to zero). They come from unstable aerodynamic calculations in the program - I saw this when I made calculations with my hands. It is unlikely that these denormal values ​​significantly affect my results, but to try to figure out where / why this happens, I tried to compile with the following error parameters:

gfortran –g –fbacktrace –ffpe-trap=invalid,zero,overflow,underflow,denormal –O3 –mcmodel=medium –o ../program.exe

Compiled program, but at runtime it crashed and returned:

 Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation. Backtrace for this error: #0 0x7F442F143E08 #1 0x7F442F142F90 #2 0x7F442EA8A4AF #3 0x4428CF in subroutine2_ at code.f:3601 (discriminator 3) #4 0x442C3F in subroutine1_ at code.f:3569 #5 0x4489DA in code_ at code.f:428 #6 0x42BdD1 in MAIN__ at main.f:235 Floating point exception (core dumped) 

I can interpret them as a hierarchy of calls running backward from 6 to 3:

* 6. There is a problem on line 235 of "main.f". [this is a call to "code.f"]

* 5. There is a problem on line 428 of "code.f". [this is a call to "routine1" in "code.f"]

* 4. There was a problem on line 3569 "code.f" in "routine 1". [this is a call to "routine 2" in "code.f"]

* 3. There was a problem on line 3601 "code.f" in "routine 2". [this is a conditional statement]

if (windspd_2m.ge.5.0) then...

Thus, a DENORMAL error should occur in "then" operations (I did not include this code because (a) it includes a long complex series of dependencies and (b) I can solve mathematical errors, these are debugging errors that I struggle with )

But for the above errors 2,1,0 ... I do not know how to interpret these strings of numbers / letters. I also do not know what discriminator 3 means. I searched for them, but the only resources I found explain them, suggesting a higher level of knowledge than I do. Can someone help me interpret these error codes, assuming very little pre-existing knowledge about Fortran, gcc or bash scripts?

+5
source share
1 answer

The first three frames of the stack are associated with the implementation of backtracing in the GFortran runtime library (libgfortran). Backtrace cannot symbolically resolve addresses in dynamic libraries, so you only get addresses. If you want to see symbolic output, you can add "-static" to your compilation options.

So my first guess was that the error is indicated in the .f: 3601 code, and since 5.0 is a constant, it follows that windspd_2m should be denormal.

+2
source

Source: https://habr.com/ru/post/1272476/


All Articles