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.
C:\test>ifort reproducer.f90 /Qinit:arrays /c
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 126.96.36.199 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.
The /Qinit:arrays option works with Ifort Version 188.8.131.527 and later versions. It does not work with the next older version that I still have, which is 184.108.40.206.