Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7957 Discussions

.exe gives NaN but same .exe attached to VS debugger works

Jack_T_
Beginner
995 Views

Hello,

i have a large project with c++,fortran,mkl .

If a start the compile .exe it calculates NaN at one point. If i start the same .exe and then attach it to VS Debugger it gives the expected results.

This happens with Intel compiler 2019 and 2020 and VS 2017 and 2019. With and without optimization.

How can i search for the reason for this problem?

Are there some settings that are different if attached to VS debugger?

I have found out that NaN comes from builtin  bessel function calculation jn(int m,double x). Always the first use of jn(m,x) gives NaN. The second use of jn(m,x) with the same values gives correct results.

Thanks

0 Kudos
5 Replies
GouthamK_Intel
Moderator
982 Views

Hi,

Thanks for reaching out to us!

Could you please share a minimal reproducer code and steps to reproduce the issue?


Regards

Goutham


0 Kudos
Jack_T_
Beginner
969 Views

Hello,

i was not able to build a reproducer yet.

The problem is not in some lines of code. It seems to be the interaction between c++,fortran,lib,dlls.(c++ routine calls fortran routine which calls c++

This is a large project with several 100.000 lines of codes plus some large libraries like opencascade.

So it not possible to send the whole project.  Simple code does not have this problem.

I have added a test routine that calculates besselfuntion  jn(1,1.0). The result should be 0.45.... . But depending on the position in the program it gives 0.45... or NaN. But only the first time. If i have found a position where the result is NaN and i add the call a second time(two calls after each other) the first result is NaN and the second result is correct.

I have traced the problem to a opencascade routine BRepAlgoAPI_Common. Before this routine jn(1,1.0) gives correct result. After the routine the result is wrong. 

I do not understand what mechanism could cause such behavior.

I am looking for some hints how to localize the reason.

This problem happens with two intel compiler versions on different computers.

I am trying to build a reproducer but this is difficult and time-consuming.

 

regards

0 Kudos
GouthamK_Intel
Moderator
940 Views

Hi,

>>"I am trying to build a reproducer but this is difficult and time-consuming."

Yeah, please share the reproducer once you have it.

>>>"This problem happens with two intel compiler versions on different computers"

Meanwhile, could you please let us know the exact compiler version and system configurations of the two computers on which you are facing this issue?

Compiler Version & Visual Studio Version (provide all the combinations for which you are getting this issue)

OS Version:

Hardware details (CPU):

>> "it not possible to send the whole project. Simple code does not have this problem."

If possible, could you please share the preprocessed files?


Thanks & Regards

Goutham


0 Kudos
GouthamK_Intel
Moderator
918 Views

Hi,

Reminder: Could you please let us know whether your issue is resolved or not? If not please share the above requested details.


Regards

Goutham


0 Kudos
GouthamK_Intel
Moderator
899 Views

Hi,

As we have not heard back from you, we are considering that your issue has been resolved and we have answered all your queries. So we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only 

Have a Good day!


Thanks & Regards

Goutham


0 Kudos
Reply