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

deadlock during debug

Isabela_Z_
Beginner
479 Views

Hi everybody,

I'm trying to find where inside my program appears the first NaN var.  So I created the following function:

logical FUNCTION testanan(var)

implicit none            
real(8) var

if (var /= var) then
    print*, 'deu NAN na', var
    TESTANAN=.TRUE.
    READ(*,*)
endif

ENDFUNCTION
                 

                

I run in debug mode and when the message appears in the screen, I press pause to find out in which line the NaN appears. But when I do that, deadlock happens...

How can I identify where is my first NaN happens?

Regards

0 Kudos
4 Replies
jimdempseyatthecove
Honored Contributor III
479 Views

Why not remove the READ and place a debugger break point on TESTNAN=?

Then when break is hit, single step out of the function.

Jim Dempsey

0 Kudos
mecej4
Honored Contributor III
479 Views

I second Jim's comments.

NOTE: If "var /= var" is false, the function value is undefined.

0 Kudos
Isabela_Z_
Beginner
479 Views

Thanks a lot Jim, I will try your suggestion and I gonna fix the result.

Best regards

0 Kudos
Steven_L_Intel1
Employee
479 Views

Please don't use var /= var to test for NaN. Use the intrinsic IEEE_ISNAN from intrinsic module IEEE_ARITHMETIC. The compiler might choose to delete your comparison under normal optimization. If you want to do such tests, you must compile with the option /fp:strict

0 Kudos
Reply