<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic DEBUG ifx VS2022 watch class variable in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/DEBUG-ifx-VS2022-watch-class-variable/m-p/1731225#M177911</link>
    <description>&lt;H3&gt;Environment&lt;/H3&gt;&lt;P&gt;Visual Studio 2022 : &lt;STRONG&gt;17.14.21&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;IFX : &lt;STRONG&gt;2025.3.0&lt;/STRONG&gt;&lt;/P&gt;&lt;H3&gt;Problem&lt;/H3&gt;&lt;P&gt;In debug mode, Visual Studio cannot display correct Watch values for a polymorphic (&lt;STRONG&gt;class&lt;/STRONG&gt;) allocatable array.&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;type :: Layer
!...
end type Layer 

type extends(Layer):: extended_Layer
!...
end type extended_Layer

class(layer),allocatable,dimension(:):: L

allocate(extended_Layer::L(5))&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;situation 1&lt;BR /&gt;&lt;/STRONG&gt;Right after allocation, I cannot inspect L correctly in the Watch window.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;situation 2&lt;/STRONG&gt;&amp;nbsp;&lt;BR /&gt;Even if I use select type, I still can’t inspect the variable properly inside the type is block:&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;select type (L)
type is (extended_Layer)
  ! ...
end select&lt;/LI-CODE&gt;&lt;P&gt;The Watch window shows an incorrect upper bound for &lt;STRONG&gt;L&lt;/STRONG&gt; (e.g., -1) as below, although print statements show the correct values at runtime.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Haku_1-1766493758068.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/70524i98887667AF74DD9A/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Haku_1-1766493758068.png" alt="Haku_1-1766493758068.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Does this mean IFX + Visual Studio currently cannot reliably display polymorphic (class) variables in Watch?&lt;BR /&gt;If so, is the recommended workaround to use print statements, or to pass the object into a subroutine with a non-polymorphic dummy argument?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Dec 2025 12:54:07 GMT</pubDate>
    <dc:creator>Haku</dc:creator>
    <dc:date>2025-12-23T12:54:07Z</dc:date>
    <item>
      <title>DEBUG ifx VS2022 watch class variable</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/DEBUG-ifx-VS2022-watch-class-variable/m-p/1731225#M177911</link>
      <description>&lt;H3&gt;Environment&lt;/H3&gt;&lt;P&gt;Visual Studio 2022 : &lt;STRONG&gt;17.14.21&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;IFX : &lt;STRONG&gt;2025.3.0&lt;/STRONG&gt;&lt;/P&gt;&lt;H3&gt;Problem&lt;/H3&gt;&lt;P&gt;In debug mode, Visual Studio cannot display correct Watch values for a polymorphic (&lt;STRONG&gt;class&lt;/STRONG&gt;) allocatable array.&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;type :: Layer
!...
end type Layer 

type extends(Layer):: extended_Layer
!...
end type extended_Layer

class(layer),allocatable,dimension(:):: L

allocate(extended_Layer::L(5))&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;situation 1&lt;BR /&gt;&lt;/STRONG&gt;Right after allocation, I cannot inspect L correctly in the Watch window.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;situation 2&lt;/STRONG&gt;&amp;nbsp;&lt;BR /&gt;Even if I use select type, I still can’t inspect the variable properly inside the type is block:&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;select type (L)
type is (extended_Layer)
  ! ...
end select&lt;/LI-CODE&gt;&lt;P&gt;The Watch window shows an incorrect upper bound for &lt;STRONG&gt;L&lt;/STRONG&gt; (e.g., -1) as below, although print statements show the correct values at runtime.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Haku_1-1766493758068.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/70524i98887667AF74DD9A/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Haku_1-1766493758068.png" alt="Haku_1-1766493758068.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Does this mean IFX + Visual Studio currently cannot reliably display polymorphic (class) variables in Watch?&lt;BR /&gt;If so, is the recommended workaround to use print statements, or to pass the object into a subroutine with a non-polymorphic dummy argument?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Dec 2025 12:54:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/DEBUG-ifx-VS2022-watch-class-variable/m-p/1731225#M177911</guid>
      <dc:creator>Haku</dc:creator>
      <dc:date>2025-12-23T12:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: DEBUG ifx VS2022 watch class variable</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/DEBUG-ifx-VS2022-watch-class-variable/m-p/1731609#M177916</link>
      <description>&lt;P&gt;I watch&amp;nbsp; this forum, mainly because of the neat people.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your question is interesting, but it would help if it was a complete small program so I could put it into a sln and run it.&amp;nbsp; I am not going to make the program.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Dec 2025 17:36:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/DEBUG-ifx-VS2022-watch-class-variable/m-p/1731609#M177916</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2025-12-27T17:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: DEBUG ifx VS2022 watch class variable</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/DEBUG-ifx-VS2022-watch-class-variable/m-p/1732979#M177985</link>
      <description>&lt;P&gt;Thanks for your reply, and I'm sorry for the late follow-up.&lt;/P&gt;&lt;P&gt;I'll share a simple program below-just copy/paste it into an empty Fortran project and it should run.&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;module simple_class
implicit none(external)
private
public :: basic_layer, advanced_layer,alayer_1

type basic_layer
integer :: layer_id
double precision:: dx,dy
end type basic_layer
type ,extends(basic_layer) :: advanced_layer
  double precision :: dz
end type advanced_layer
class(basic_layer),allocatable :: alayer_1(:)
contains
end module simple_class

program main
use simple_class,only:  advanced_layer,basic_layer,alayer_1
type(basic_layer) :: layer1
type(advanced_layer) :: layer2
class(basic_layer),allocatable :: layer3,layer4

!===successful watcher debug session===
layer1%layer_id = 1
layer1%dx = 0.1d0;layer1%dy = 0.2d0
continue

layer2%layer_id = 2
layer2%dx = 0.3d0;layer2%dy = 0.4d0;layer2%dz = 0.5d0
continue

allocate(basic_layer::layer3)
select type(layer3)  ! to confirm the dynamic type
type is (basic_layer)
  layer3%layer_id = 3
  layer3%dx = 0.6d0;layer3%dy = 0.7d0
end select

continue

allocate(advanced_layer::layer4)
select type(layer4)  ! to confirm the dynamic type
type is(advanced_layer)
  layer4%layer_id = 4
  layer4%dx = 0.8d0;layer4%dy = 0.9d0;layer4%dz = 1.0d0
  print *, "layer4%dz =", layer4%dz
end select
continue
!===successful watcher debug session===

!===failure watcher debug session===
allocate(advanced_layer::alayer_1(3))
select type(alayer_1)  ! to confirm the dynamic type
type is(advanced_layer)
  alayer_1(:)%layer_id = 5
  alayer_1(:)%dx = 1.1d0;alayer_1(:)%dy = 1.2d0;alayer_1(:)%dz = 1.3d0
  print *, "alayer_1(1)%dz =", alayer_1(1)%dz
end select
continue
!===failure watcher debug session===

!===successful watcher debug session===
!-use block to see the content
test : block
type(advanced_layer) :: aLayer(3)
select type(alayer_1) ! to confirm the dynamic type
type is (advanced_layer)
  aLayer = alayer_1
end select

continue
end block test
!===successful watcher debug session===

end program main&lt;/LI-CODE&gt;&lt;P&gt;As shown in comments:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If I define a variable as &lt;STRONG&gt;type(layer1,layer2)&lt;/STRONG&gt; or as a scalar c&lt;STRONG&gt;lass (layer3,layer4)&lt;/STRONG&gt;, it can be inspected correctly in the debug Watch window.&lt;/LI&gt;&lt;LI&gt;However, when I define an &lt;STRONG&gt;array of class&lt;/STRONG&gt;, the Watch failed and shows stange values (like in the picture below).&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Haku_0-1767942349649.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/70662iF0564D8E4FF727C9/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Haku_0-1767942349649.png" alt="Haku_0-1767942349649.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For now, the only workaround I have is the last "&lt;STRONG&gt;block&lt;/STRONG&gt;" part: by assigning an element into a specific type variable (&lt;STRONG&gt;aLayer&lt;/STRONG&gt;),I can watch this aLayer variable to check the original variable. But it's tedious to insert this block everywhere just for debugging.&amp;nbsp;&lt;BR /&gt;Is it simply hard(or unsupported) for the debugger to inspect an array of class objects? Even though the OOP part in fortran attract me a lot.&lt;BR /&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2026 07:16:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/DEBUG-ifx-VS2022-watch-class-variable/m-p/1732979#M177985</guid>
      <dc:creator>Haku</dc:creator>
      <dc:date>2026-01-09T07:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: DEBUG ifx VS2022 watch class variable</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/DEBUG-ifx-VS2022-watch-class-variable/m-p/1733101#M177998</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-01-10 103301.png" style="width: 999px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/70678i0CE140B2D2094AAE/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot 2026-01-10 103301.png" alt="Screenshot 2026-01-10 103301.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I cannot see the variables and it crashes the debugger, your method will work it is not elegant, and in pure math not elegant is the kiss of death.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Last night, I had to spend several hours in a fast food restaurant who serve H_ppy M_als, and so I read a Project Gutenberg book on the Tenth (Irish) Division in WW1.&amp;nbsp; It is incredibly satisfying read and has some great English sentences.&amp;nbsp; &amp;nbsp;If you think you are having a bad day, this will show you it can get a lot worse.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jan 2026 16:44:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/DEBUG-ifx-VS2022-watch-class-variable/m-p/1733101#M177998</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2026-01-10T16:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: DEBUG ifx VS2022 watch class variable</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/DEBUG-ifx-VS2022-watch-class-variable/m-p/1733113#M177999</link>
      <description>&lt;P&gt;Thank you for your interesting suggestion.&lt;BR /&gt;As a result, since the debugger has trouble inspecting arrays of class objects, I decided to use a preprocessor-based approach to the basic type so that it can be inspected in the watch window.&lt;/P&gt;&lt;P&gt;Have a nice day!!&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jan 2026 09:50:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/DEBUG-ifx-VS2022-watch-class-variable/m-p/1733113#M177999</guid>
      <dc:creator>Haku</dc:creator>
      <dc:date>2026-01-11T09:50:28Z</dc:date>
    </item>
  </channel>
</rss>

