Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29530 Discussions

Observation: If ONLY used in subroutine then variables will NOT display in DEBUG

bmchenrync
New Contributor I
1,068 Views

I was having issues with being able to view variables in Debug in VS 2022 v 2026 in certain subroutines

and couldn't figure out why?

did the ole 'all CAPS' but didn't fix it...

and then i noticed/discovered that

in VS 2022/2026

IF you use ONLY to specify the ONLY variables in a MOD used in a subroutine

then in DEBUG

VS will NOT display the variable value and in Watch window is will say undefined!

 

Once i commented out all ONLY specifications

Then ALL variables used in the subroutine reveal their values!

 

strange?

Or is this the appropriate behavior with 2026/2022

 

 

 

1 Solution
bmchenrync
New Contributor I
203 Views

With update out and some folks saying things not working and since i started this topic

I tested (why not gamble, eh?!)

DEBUG WATCH/CHECK VARIABLE VALUES WORK

Test run on my win10 computer (so expect all will work on my win11 computer too which i will check later or tomorrow)

  • Visual Studio 2026 18.5.2
  • INTEL Fortran 2026.0.0.566
  • FEE_VSIX_V17

A right mouse hover over a variable produces variable value if Module without USE statement

Module name::Variable lists value in watch window for Modules with USE statement

BRAVO!

Great work INTEL!

 

View solution in original post

0 Kudos
22 Replies
FortranFan
Honored Contributor III
978 Views

@Igor_V_Intel ,

May you please review this with VS integration team at Intel, perhaps in conjuction with the Fortran compiler team?

Please consider the attachment here and illustration below as a minimal reproducer the Intel team can utilize.

To add to OP's post, please consider a trivial module file m.f90 in a Visual Studio project as follows:

module m
   integer :: a = 42
   integer :: b = 24
end module m

And a consuming program like so:

   use m, only : a
   print *, a
end

As mentioned by OP, the USE statement with ONLY clause masks the object in the debugger:

v2.png

Whereas without the ONLY clause, the debugger identifies the object - see below:

v1.png

0 Kudos
FortranFan
Honored Contributor III
981 Views

@Igor_V_Intel ,

May you please consider a variant of the above case for a quick review with Intel team and comment here?

Consider the module to employ PRIVATE/PUBLIC attributes to control visibility and USEability:

module m
   private
   integer, public :: a = 42
   integer :: b = 24
end module m

Now, similar to IFORT and earlier versions of Visual Studio, one can utilize "qualified" names of objects viz. module_name::object_name to watch the objects in the debugger.  Interestingly this facility ignores the Fortran language PRIVATE/PUBLIC attributes which can be bothersome to some working in the proprietary codebase.

v3.png

 

Are the above two aspects as Intel software teams have intended?

Thank you,

P.S.> A team I work with reported this issue to me upon seeing the original post.  The issue is of great concern and it will be highly beneficial if the VS integration team can include a fix for this as soon as possible.

0 Kudos
bmchenrync
New Contributor I
964 Views

Hello,

Sorry i missed your responses yesterday.

Once back in my cage (aka the office) i will test and give response early next week (you know how Mondaze Mondaze go...)

 

Thank you for the response and ideas and will get back to you soon

 

Have a great weekend!

 

b

 

 

0 Kudos
bmchenrync
New Contributor I
864 Views

now back in office i see Fortranfan clarified what i had posted so looking forward to seeing Intel's response.

0 Kudos
yzh_intel
Moderator
816 Views

Hi, I did reproduce your observation about the private/public attributes, but couldn't reproduce that with "only"

It still can show the value of a, even I have the "only" specifier in front of it. Did I miss anything ? Do you have the Intel Fortran Expression Evaluator installed ? 

I'm using VS2026 and ifx 2025.3.2.

 

only.png

bmchenrync
New Contributor I
806 Views

I haven't tried the public/private

  • guess i mainly use the ONLY so i know/specify which modules variables come from

however

  • if I specify in the watch window
    • module::variable
    • it does show in the watch window

 

However,

In my debug trials and tribulations I prefer/need/want to be able to simply right click and view the variable value

VS 2022 (Version 17.14.29 (March 2026))

VS2026 (just now updated to 18.4.3)

also Intel® Fortran Compiler 2025.3.3 [Intel(R) 64]

 

  • if i use ONLY on a variable in a module i can only see values in the Watch window and not with the right mouse click 
  • whereas if i remove the ONLY from modules then i can see the values of any of the variables used in the subroutine or program unit with a simple right click of the mouse
yzh_intel
Moderator
800 Views

Hi, Please continue to use module::variable in the watch window as a workaround.

I can reproduce your observation now if I only enter "a" instead of "m::a" in the watch window. And if you hover the cursor above the variable during debug, it doesn't show its value. This is indeed somewhat inconvenient.

As far as I can understand now, this seems a deliberate design in the compiler, that for code "use m, only : a", no new variable is created, instead it's replaced with "m::a" during compile time and that's why you see the error "Undefined variable a" when trying to see its value. 

I have escalated this issue to the compiler team and will get back once I get any updates.

only1.png

 

andrew_4619
Honored Contributor III
762 Views

Thank you for looking at this and the explanation. I too suffer from this and it does indeed impact quite significantly on productivity when debugging. I was now aware of the ONLY issue I thought is was all module variables. This was because I generally ONLY use ONLY i.e. in 99% of cases. At least I can make a temporary edit to use "all" for specific debug activities as a workaround, that is still a pain because when hunting for where a problem happens I use  'hover' until I have homed in of some specific routine.

yzh_intel
Moderator
661 Views

Hi, I have some updates that the issue has been fixed with the 2026.0 release. Please verify when the package goes public. 

Right now, the variable "a" can be resolved in watch window, it also shows up in the locals window and when you hover your cursor on it. 

 

only_2026p0.png

andrew_4619
Honored Contributor III
637 Views
0 Kudos
AlexM1
Beginner
199 Views

I also had issues with watching variables in debug if specifying "use module, only : var" with VS2022 17.4.x , Intel 2025.3, and FEE 2025.2.2. We also lost the ability to hover over the variable to see the values.

 

I got the 2026.0 compiler installed last week and the behavior is now worse than 2025.3. Now all module variables, including ones with no "module, only" designation are showing up as undefined. I deleted my .VS folder, full clean build, all extensions up to date, IFEE still latest available as 2025.2.2. Attached is a snapshot of a very simple sample code.

 

AlexM1_0-1777902366415.png

 

0 Kudos
AlexM1
Beginner
198 Views

Sorry, Visual Studio version is 17.14.25.

0 Kudos
nathn34
New Contributor I
596 Views

Hey, I’ve seen something kinda similar in VS before, so your confusion makes sense.

What you’re running into is basically how the debugger handles scope + compiler optimization when you use ONLY in a module. It’s not really “breaking”, but it does feel like it because debug visibility gets weird.

I had a case in VS2022 where I thought variables were just not being passed correctly, but turns out the debugger simply wasn’t exposing them due to how the compiler was treating that restricted scope. When I removed or loosened the ONLY list, suddenly everything appeared again in Watch window.

What worked for me:

Try compiling with Debug config (not Release optimized)

Avoid heavy ONLY filtering inside modules you actively debug

Use explicit local copies inside the subroutine if needed

Sometimes rebuilding solution clears stale debug symbols too

It’s one of those “technically expected behavior, but still confusing” things in VS.

Not sure if it’s improved in newer builds or still same in 2026 version, but yeah, you’re not imagining it.

By the way, I’ve also hit similar quirks while testing small modules in my own projects under “U-Shop” dev setup — debugging scope can really mess with visibility sometimes.

Have you tried isolating it in a minimal repro project to confirm it’s ONLY-related?

0 Kudos
bmchenrync
New Contributor I
204 Views

With update out and some folks saying things not working and since i started this topic

I tested (why not gamble, eh?!)

DEBUG WATCH/CHECK VARIABLE VALUES WORK

Test run on my win10 computer (so expect all will work on my win11 computer too which i will check later or tomorrow)

  • Visual Studio 2026 18.5.2
  • INTEL Fortran 2026.0.0.566
  • FEE_VSIX_V17

A right mouse hover over a variable produces variable value if Module without USE statement

Module name::Variable lists value in watch window for Modules with USE statement

BRAVO!

Great work INTEL!

 

0 Kudos
bmchenrync
New Contributor I
105 Views

unfortunately it isn't 100% working

on a project it wouldn't reveal the values etc

have not yet tested on win11 will do so today

but progress is made as it does work in some instances and if i can isolate WHY it doesn't work in others, i will post up a sample for INTEL to take a look/see at

 

0 Kudos
AlexM1
Beginner
83 Views

Hi B, just to clarify, did you clean your solution and recompile with 2026.0? Because the behavior your describing is the behavior we saw in 2025.3 and without a clean it might not actually be recompiling. In 2026.0, all module variables cannot be hovered over and all module variables require Module::var in the watch window even if they are within scope from the use module statements. This is a severe debugging regression we are seeing from switching from ifort.

AlexM1_0-1777997799742.png

In my picture are side by side watches of 2025.3 and 2026.0.

1. Red boxes: In 2025.3 if a module variable was set within the same file as the subroutine making a "use module, only :" statement, then that variable was watchable with hover over or in the watch window WITHOUT "module::var". No longer working in 2026.0.

2. Blue boxes: (worse in 2026.0) In 2025.3 not using the ", only :" statement allowed us to hover over and watch values without "module::var". In 2026.0, this now appears to also be undefined and we cannot hover over the variable.

3. Green boxes: In both 2025.3 and 2026.0 you cannot hover over nor watch any module variable if its included in a "use module, only:" statement. All module variables require "module::var".

We should be able to watch all module variables that are within scope without having to manually type in "module name::var" into the watch window like we were able to in ifort.

0 Kudos
AlexM1
Beginner
82 Views

Just for completion sake, I have also attached an image of the same sample solution watch behavior in oneapi 2023 ifort. Everything within scope of the subroutine is easily watchable with or without module::var and everything can be hovered over.

AlexM1_0-1777999701274.png

 

0 Kudos
bmchenrync
New Contributor I
76 Views

as i recall you are using an older version of Visual Studio? 17.14.25

you might update visual studio to latest?

Recall i am using

  • VS 2022 (Version 17.14.29 (March 2026))
  • VS2026 (just now updated to 18.4.3)
  • also Intel® Fortran Compiler 2025.3.3 [Intel(R) 64]

i did recompile all with latest compiler after clean (from menu)

when have chance later will be sure fully cleaned out the directory etc (i recall back in the day clean did not entirely clean all out...so will double check)

 

 

b

 

 

 

0 Kudos
bmchenrync
New Contributor I
76 Views

wish this had ability to edit (like phpBB Forums do!)

i'm using

  • Visual Studio 2026 18.5.2
  • INTEL Fortran 2026.0.0.566
  • FEE_VSIX_V17

 

 

0 Kudos
bmchenrync
New Contributor I
90 Views

Tested on Win11

and then re-tested on Win10

with 2 separate projects

and both behave the same (so far and this is a quick look/check)

Some initial observations:

  • You need to remove ONLY and can ONLY look at variable values MODULENAME::VARIABLENAME in watch window
  • Case does not matter (upper/lower case is fine in variable and watch window)
  • Local variables values can be checked with right mouse click
  • Module variables only can be viewed in Watch window
    • One minor issue (for me) with one of my programs:
      • I use equivalence to be able to reset to 0 entire modules (rather than individual elements) (from program written a while ago)
        • ONLY the array variable equivalenced to the individual variables is viewable in the subroutine
        • For examples if you have a module with 50 variables and you equivalence each of those 50 variable names to an array All_VARIABLES(1:50)
          • (so you can simply set ALL_VARIABLES(1:50) to 0
        • in Subroutines you can ONLY watch elements in ALL_VARIABLES(1:50)  NOT the individual variable names 

Still checking things but it appears to work as expected except individual module elements ONLY in watch window

 

and apologies for TMI and not reading release notes since all this may be obvious/documented!

 

More checking soon (but cage being rattled so need to get back to project work!)

 

B

 

0 Kudos
Reply