I found different results between Debug and Release version of the same program.
I have just read some posts in this topic.
I would like to set my compiler in order to have a NaN for not initialized scalar and array.
In this way, with /fpe:0, I should have an error, avoiding errors in release version.
What shall I set in the compiler?
I am afraid that there is no simple solution. There are many causes for the single symptom that you stated: results changing when compiler options are changed. Not surprisingly, there is no single compiler option to help you to locate and fix the problems in your code.
See the Intel documentation for details regarding the various /check and /warn options.
If you can post the code and show us what kinds of differences you see, someone may be able to make suggestions for a solution.
Unfortunately the code is very large and a non disclosure agreement doesn't let me to share that.
In some thread I found Qinit:snan,arrays could initialize as NaN the variables, but my compiler doesn't recognize this command.
Which is the correct set?
C:\test>ifort reproducer.f90 /Qinit:arrays /c
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 22.214.171.124 Build 20200306
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.
Works fine for me, what version are you using? Maybe post the full command line and output as above.