简体   繁体   English

解释gfortran错误回溯

[英]Interpreting gfortran error traceback

I'm running a Fortran 77 program written by someone else. 我正在运行由其他人编写的Fortran 77程序。 I'm using the gfortran compiler (v5.4.0) on Linux (Ubuntu v.16.04). 我在Linux上使用gfortran编译器(v5.4.0)(Ubuntu v.16.04)。 I'm not an experienced user of Fortran, gcc or bash scripting, so I'm struggling here. 我不是Fortran,gcc或bash脚本的有经验的用户,所以我在这里苦苦挣扎。

When my program finishes running, I get the following message: 当我的程序运行完毕后,我收到以下消息:

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

I had to look this up - I understand that some of my floating-point numbers need to be stored "denormal", a low-precision form for very small numbers (rather than flushing them to zero). 我不得不这样看 - 我明白我的一些浮点数需要存储为“非正规”,这是一种非常小数字的低精度形式(而不是将它们刷新为零)。 These come from the unstable aerodynamic calculations in the program - I've seen this when doing the calculations longhand. 这些来自程序中不稳定的空气动力学计算 - 我在进行计算时看到了这一点。 It's unlikely that these denormal quantities are significantly affecting my results, but to try and find out where/why this was happening, I tried compiling with the following error options: 这些非正规数量不太可能显着影响我的结果,但是为了尝试找出这种情况发生的位置/原因,我尝试使用以下错误选项进行编译:

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

The program compiled, 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 these as a hierarchy of calls, working backwards from 6 to 3: 我可以将这些解释为一个调用层次结构,从6到3向后工作:

*6. * 6。 At line 235 of "main.f", there was a problem. 在“main.f”的第235行,出现了问题。 [this is a call to "code.f"] [这是对“code.f”的调用]

*5. * 5。 At line 428 of "code.f", there was a problem. 在“code.f”的第428行,出现了问题。 [this is a call to "subroutine1" in "code.f"] [这是对“code.f”中“subroutine1”的调用]

*4. * 4。 At line 3569 of "code.f", in "subroutine1", there was a problem. 在“code.f”的第3569行,在“子程序1”中,出现了问题。 [this is a call to "subroutine2" in "code.f"] [这是对“code.f”中“subroutine2”的调用]

*3. * 3。 At line 3601 of "code.f", in "subroutine2", there was a problem. 在“code.f”的第3601行,在“子程序2”中,出现了问题。 [this is a conditional statement] [这是条件声明]

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

So the DENORMAL error must be occurring in the "then" operations (I haven't included that code because (a) it involves a long, complicated series of dependencies, and (b) I can unravel the math errors, it's the debug errors I'm struggling with). 因此,DENORMAL错误必须在“then”操作中发生(我没有包含该代码,因为(a)它涉及一系列长而复杂的依赖关系,并且(b)我可以解开数学错误,这是调试错误我正在努力)。

But for the above errors 2,1,0... I don't know how to interpret these strings of numbers/letters. 但是对于上面的错误2,1,0 ......我不知道如何解释这些数字/字母串。 I also don't know what "discriminator 3" means. 我也不知道“鉴别器3”是什么意思。 I've googled these, but the only resources I've found explain them assuming a higher level of knowledge than I have. 我用谷歌搜索了这些,但我发现的唯一资源解释了他们假设的知识水平高于我的水平。 Can anyone help me to interpret these error codes, assuming very little pre-existing knowledge of Fortran, gcc, or bash scripting? 假设对Fortran,gcc或bash脚本的预先知识很少,那么有人可以帮我解释这些错误代码吗?

The first three stack frames are due to the implementation of backtracing in the GFortran runtime library (libgfortran). 前三个堆栈帧是由于在GFortran运行时库(libgfortran)中实现了回溯。 The backtrace can't resolve addresses in dynamic libraries symbolically, hence you get just the addresses. 回溯无法以符号方式解析动态库中的地址,因此您只能得到地址。 If you want to see symbolic output, you can add "-static" to your compile options. 如果要查看符号输出,可以在编译选项中添加“-static”。

Thus my first guess would be that the error is at code.f:3601, and since 5.0 is a constant it follows that windspd_2m ought to be denormal. 因此我的第一个猜测是错误在code.f:3601,并且由于5.0是一个常量,因此windspd_2m应该是非正规的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM