'denormal exception in gdb debugger for gfortran
I'm compiling with gfortran including the compiler options -g -fbacktrace -ffpe-trap=invalid,zero,overflow,underflow,denormal This has lead to an executable that runs under the gdb debugger, but when running normally a floating point exception occurs. The latter disappears if I recompile without the denormal trap.
Could it be that the denormal trap does not work when running with gdb?
Any suggestions on how to find where the floating point exception occurs?
Solution 1:[1]
By running a simple test it appeared that that denormal trap remained active both under normal and fdb execution even only the underflow trap and not denormal trap was included in the compilation.
The problem was finally traced back to uninitialized variables, which reasonably might take on different different values with gdb or normal execution. To localize the problem without the debugger, I used not only many debugging write statements, but also stop statements moved sequentially further back until the error was localized, for it appears that the code races ahead of the write statements, and a later fpe may cause a write statement not to be executed even if it occurs before the fpe.
Somehow the -Wuninitialized compiler option had not detected the use of uninitialized variables.
These experiences are indeed from a windows installation of gfortran and the associated fdb debugger, that dates back to around 2016.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | R. Peek |
