Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

FPE Trapping

emrey
Beginner
757 Views

Hello,

In my code there are several palces producing Nan. For some reason, I want to trap only one of them which is in a specific module, not the other ones. What I tried and did not work is,

1) When I activate the -fpe0 option the programme stops at the first Nan which is not the one I want to trap. 

2) I compiled only the module of interest with the -fpe0 option. This did not work either.

3) I used IFCORE module and the FOR_SET_FPE option only in the module of ineterst. However, this is also catching all the Nan all over the entire programme.

How can I trap the Nans only in a specific module/subroutine?

0 Kudos
3 Replies
andrew_4619
Honored Contributor III
757 Views

If you know what variable(s) you are looking at you can call the function IEEE_IS_NAN (x), an then do something based on a TRUE result such as output some data or set a debugger breakpoint....

0 Kudos
emrey
Beginner
757 Views

I am aware of isnan function, but this is not a problem that can be solved with this approach (Huge iterative code, hard to trace a Nan with debugger ...etc). I need a method defined in my first post. Thank you anyway.

0 Kudos
Steven_L_Intel1
Employee
757 Views

Use /fpe-all:0 on the routine where you want to trap. /fpe (without -all) affects the main program only,

0 Kudos
Reply