Watch Window shows incorrect value for REAL variables in Fortran debug mode (Visual Studio + Intel Fortran)
Hello everyone,
I’m facing a strange issue in Visual Studio while debugging a Fortran project. I'm using Intel Fortran (oneAPI) with Visual Studio 2019, and everything works fine except the Watch window in debug mode shows incorrect values for some REAL
variables.
I defined two variables as follows:
REAL :: MainWidth, MainHeight
Then I read their values from a formatted input file:
READ (5,31) MainWidth, MainHeight
WRITE(*,*) 'Main = ', MainWidth, MainHeight
31 FORMAT (2F8.0)
When I run the code, the output is correct:
Main = 20000.00 20000.00
However, in the Watch Window, MainHeight
shows something like 30.0
, and MainWidth
shows a large garbage number like 1184645120
and are interpreted as an INTEGER(4)
.
Even though the variable is declared as REAL
, Visual Studio seems to misinterpret its type during debugging.
I've attached screenshots showing:
Why does the Watch window interpret a REAL
variable as INTEGER(4)
even though it's correctly declared?
Is this a known issue with Intel Fortran or Visual Studio debug integration?
- Is there a workaround to force correct type recognition in the Watch window?
Thanks for your time and support 🙏