Software Archive
Read-only legacy content
17061 Discussions

Debugger unable to display array contained in derived type

Hervé_Martin
Beginner
502 Views

Hello,

I did post this some time ago on the Intel Visual Fortran forum, but I go no answer so far. I hope I will have more success on this forum.

Since months debugging has been a hell because of a bug in the Intel Compiler and/or debugger integration: basically most (but not all) arrays are displayed with the length 0 in the debugger, and their content cannot be shown. The bug happens with allocatable arrays, pointers or static arrays. Of course it makes debugging pretty impossible, and I have to use WRITE statements... For instance the debugger shows me this:

2016-09-09%2009-27-40.png

whereas the array ARR has the size 2!

I finally succeeded to reproduce the bug with a simple program:

PROGRAM Console
  USE m1
  IMPLICIT NONE
  TYPE(TypeBase) :: ObjectBase
  TYPE(TypeExt)  :: ObjectExt
  WRITE(*,*) 'Set a breakpoint here => debugger shows ObjectBase%Arr with length 0!!!'
END PROGRAM

and the module M1 is:

MODULE M1
  IMPLICIT NONE
  PRIVATE
  TYPE, PUBLIC :: TypeBase
    REAL :: Arr(2) = 0.0
  CONTAINS
    PROCEDURE :: AFunction
  END TYPE
  TYPE, PUBLIC, EXTENDS(TypeBase) :: TypeExt
  END TYPE
CONTAINS
FUNCTION AFunction(this) RESULT(Res)
  CLASS(TypeBase), INTENT(IN) :: this
  TYPE(TypeBase)  :: Res
END FUNCTION
END MODULE 

As you can see it needs a tricky combination:

  • If you comment the declaration of the variable ObjectExt in the program, it works as expected (debugger displays correct length and content)
  • If the function AFunction is not type bound anymore, it works as expected
  • If AFunction is made a subroutine, it works as expected
  • If one removes the type extension, it works as expected

So it seems that using a combination of type-bound functions and type extension prevents the debugger (or the Fortran expression evaluator FEE) to show the length and content of arrays contained in derived types. I tried to play with debugger options in Visual Studio, and also with compiler settings, without success.

I am using Visual Studio 2015. I had the problem with the VS 2015 Update 2, and now Update 3, and with both Intel Visual Fortran 2016 and 2017.

0 Kudos
2 Replies
Georg_Z_Intel
Employee
502 Views

Hello,

at first glance it looked like you're right here since you use the debugger. So I checked with our FEE engineers and they confirmed the issue. However, it's compiler related since the debug information seems to be faulty in that exact case.

As a result I've filed an internal ticket (DPD200588188) to improve the debug information generation of the Intel Fortran Compiler. As soon as this is fixed, I'll let you know.

Best regards,

Georg Zitzlsberger

0 Kudos
Hervé_Martin
Beginner
502 Views

Hi Georg,

That's great news. I hope it will be fixed soon, at the moment debugging is almost impossible...

Best regards

Hervé

0 Kudos
Reply