Floating-point exceptions are signalling in new gfortran version

前端 未结 1 1462
无人及你
无人及你 2020-12-22 00:11

I am currently working to debug a subroutine of some software that my boss has written back in the 90s. There seems to be a floating-point exception that occurs in a do loop

相关标签:
1条回答
  • 2020-12-22 01:04

    There seems to be two questions here. Lets try to answer each one.

    1. Why does the new GFortran version print such a message

    Since the Fortran 2008 standard requires that execution of the STOP and ERROR STOP statements outputs a list of currently signaling FP exceptions (if such a thing is supported by the system), GFortran follows this as of GFortran version 4.9. See https://gcc.gnu.org/ml/fortran/2013-06/msg00072.html .

    2. Why does my code trigger this exception, and why does it only happen with the new GFortran version

    Very likely, the exception was signalling before as well, but since it wasn't printed at the STOP statement you weren't aware of it. Since the example you have showed isn't self-contained (I can't compile and test it), I can only recommend you try the usual debugging command line options such as "-fcheck=all, -ffpe-trap=invalid,zero,overflow -g -Wall -Wextra -Werror -pedantic", check running your program under valgrind etc.

    0 讨论(0)
提交回复
热议问题