- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have installed Windows 11, Visual Studio 2019 Community and Intel oneAPI 2021 Base and HPC Toolkit. When I run my program, sometimes it produces wrong results due to NaN variables (in the attached file I have stopped the loop to see the problem). Some other times it does not run at all. Finally, sometimes it runs and produces correct results without any issue. Is there anything I can do to solve this problem?
Best regards,
Dr. Elias N. Eliopoulos
University of Patras
Department of Mechanical Engineering & Aeronautics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One possible reason is that one or more variables in your program have not been set before they are used. Then the value may be anything - Fortran does not automatically initialise variables!
Other possibilities: incorrect argument lists for subroutine and function calls or violation of array bounds. In that case some random memory is accessed.
What you should do is turn on all runtime checks. A debug version of the program will definitely help with that. If you select the debug configuration in Visual Studio, you are likely to get all such checks automatically.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One possible reason is that one or more variables in your program have not been set before they are used. Then the value may be anything - Fortran does not automatically initialise variables!
Other possibilities: incorrect argument lists for subroutine and function calls or violation of array bounds. In that case some random memory is accessed.
What you should do is turn on all runtime checks. A debug version of the program will definitely help with that. If you select the debug configuration in Visual Studio, you are likely to get all such checks automatically.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The debug version solved my problem.
Thank you very much,
Dr. Elias N. Eliopoulos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please be aware that the debug version may behave in a different way than the release version. Did you find the cause of the problem via the debug version or was that simply behaving in a better way? If the latter, then the difference in initialisation between debug and release has hidden the underlying bug. That is very probably an uninitialised variable somewhere in the program.
Can you tell us what you have to do to solve the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
the problem was that a few variables were set to have incorrect dimensions. I found out by using the debug version of the program. After fixing this problem, the debug and release version run without any issue.
Best regards,
Dr. Elias N. Eliopoulos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah, good to hear that - in the past I have run into such differences I described. But you found the actual errors.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page