# ifort: Debugging module variables issue

**URL:** <https://community.intel.com/t/ifort-debugging-module-variables-issue/121037>\
**Category:** Intel® Fortran Compiler\
**Created:** [February 6, 2024, 3:58pm UTC](https://community.intel.com/t/ifort-debugging-module-variables-issue/121037 "2024-02-06T15:58:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uwe\_H](https://avatars.discourse-cdn.com/v4/letter/u/6629FF/32.png) [@Uwe\_H](https://community.intel.com/u/Uwe_H)\
**Post date:** [February 6, 2024, 3:58pm UTC](https://community.intel.com/t/ifort-debugging-module-variables-issue/121037/1 "2024-02-06T15:58:58Z")

</div>

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

```fortran
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)…

---

<div class="post-metadata">

**Author:** ![Steve\_Lionel](https://sea3.discourse-cdn.com/intel/user_avatar/community.intel.com/steve_lionel/32/94712_2.png) [@Steve\_Lionel](https://community.intel.com/u/Steve_Lionel)\
**Post date:** [February 6, 2024, 5:44pm UTC](https://community.intel.com/t/ifort-debugging-module-variables-issue/121037/2 "2024-02-06T17:44:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Uwe\_H](https://avatars.discourse-cdn.com/v4/letter/u/6629FF/32.png) [@Uwe\_H](https://community.intel.com/u/Uwe_H)\
**Post date:** [February 7, 2024, 11:19am UTC](https://community.intel.com/t/ifort-debugging-module-variables-issue/121037/3 "2024-02-07T11:19:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Devorah\_H\_Intel](https://sea3.discourse-cdn.com/intel/user_avatar/community.intel.com/devorah_h_intel/32/95067_2.png) [@Devorah\_H\_Intel](https://community.intel.com/u/Devorah_H_Intel)\
**Post date:** [February 8, 2024, 10:10pm UTC](https://community.intel.com/t/ifort-debugging-module-variables-issue/121037/4 "2024-02-08T22:10:22Z")

</div>

Please provide a test case for the hang.

> [@External Image](https://avatars.discourse-cdn.com/v4/letter/u/6629FF/48.png):
>
> wrote:
> 
> 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”).

---

<div class="post-metadata">

**Author:** ![JohnNichols](https://sea3.discourse-cdn.com/intel/user_avatar/community.intel.com/johnnichols/32/93616_2.png) [@JohnNichols](https://community.intel.com/u/JohnNichols)\
**Post date:** [February 8, 2024, 11:49pm UTC](https://community.intel.com/t/ifort-debugging-module-variables-issue/121037/5 "2024-02-08T23:49:10Z")

</div>

![Screenshot 2024-02-08 174144.png](https://us1.discourse-cdn.com/intel/original/3X/f/c/fc51503753565e1fff530b7d383dd9c8e5b06ede.png)

IFX is ok, IFORT is not good, you need the m::i, it&nbsp; 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.

---

<div class="post-metadata">

**Author:** ![Uwe\_H](https://avatars.discourse-cdn.com/v4/letter/u/6629FF/32.png) [@Uwe\_H](https://community.intel.com/u/Uwe_H)\
**Post date:** [February 12, 2024, 8:25am UTC](https://community.intel.com/t/ifort-debugging-module-variables-issue/121037/6 "2024-02-12T08:25:17Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![JohnNichols](https://sea3.discourse-cdn.com/intel/user_avatar/community.intel.com/johnnichols/32/93616_2.png) [@JohnNichols](https://community.intel.com/u/JohnNichols)\
**Post date:** [February 12, 2024, 3:19pm UTC](https://community.intel.com/t/ifort-debugging-module-variables-issue/121037/7 "2024-02-12T15:19:14Z")

</div>

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