ifort: Debugging module variables issue

I´m trying to debug variable i in the following code:

module m
  implicit none
  save
  private
  integer :: i = -1

  public f
  contains

  logical function f()
    i = 3
    f = .true.
  end function f
end module m

program main
  use m
  if(.not.f()) continue
end program main

The issue is that I cannot easily see the value of the module variable i. Mouse-hovering over it does not show anything. Adding it to a watch window gives “Undefined variable i”. Only when I add a watch like “m::i” it will display the value correctly. For local variables debugging works as expected. Visual Studio version is 2022 (17.8.6), oneApi is 2024.0.2, ifort 2021.11.0. Installed components are just gdb support from the base toolkit and the fortran compiler from hpc.

Using ifx debugging works as expected. Unfortunately I cannot switch the real project to ifx now. One of the reasons is that while debugging works fine for the above lines of code in the real project the debugger with ifx will hang after having hit the first breakpoint (“A debugger operation is taking longer than expected”).

Btw. I remember having seen this issue many years ago (10+ I think)…

That’s just the way it works - sorry. You’ve already found the workaround.

Thanks Steve. I´m surprised though - debugging module variables has been working as described for me before updating from oneAPI 2023 to 2024, and for many versions before that. Also I have found old posts where people claim it only works if the variable is being used in the current function - so this feature must have been dropped at some point then.

Please provide a test case for the hang.

IFX is ok, IFORT is not good, you need the m::i, it  is gone after the end of the year except for old versions according to what I have read.

All the code I have tested transitions to IFX without problems.

I found that the hanging debugger is related to a C static library project linked to the fortran dll. I have tried to make a minimal reproducer but anything smaller than the production code just worked, so sorry I cannot contribute here. Fortunately I could just remove that C static library as it no longer being used anyway.

I cannot currently make the switch to ifx as it must be aligned with other projects and we need to set aside a bit of time to analyse what to look out for during migration. However, this goes for the release build only, no problem to use ifx for debugging, and with that now everything works as I had hoped!

I am the only one who uses my code, so I never go off debug.  Sorry.