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

watch variables values in debug mode

mariospapa
Beginner
1,173 Views
Hello,

I want to watch values of vDataType(i), in debugging mode when the cursor is inside subroutine SR1. But when the cursor is inside SR1 in Watch Window says "Undefined array/pointer vDataType" for vDataType. What happens? How i can see these values when i'm in debugging mode?


Module M1
Use M2
Contains

Subroutine SR1
Allocate vDataType(100)
Do i = 1, 100
Read(1,*) vDataType(i).fA, vDataType(i).fB, vDataType(i).fC
End Do
End Surboutine SR1

End Module M1


Module M2
Type User
Real(8) :: fA, fB, fC
End Type User

Type(User), Allocatable :: vDataType (:)
End Module M2


Thank you in advance!


PS. I'm using Intel Fortran Compiler Integration for Microsoft Visual Studio* 2008, 11.0.3451.2008
0 Kudos
5 Replies
Les_Neilson
Valued Contributor II
1,173 Views
In the watch window type m2::vDataType then the debugger definitely knows thatthe array is in the module m2

Les
0 Kudos
Steven_L_Intel1
Employee
1,173 Views
It sounds as if the Fortran debug expression evaluator is not working for you. In the Locals window, do the types for the locals display as Fortran types (eg. REAL(4)) or as C types ("float", etc.)?
0 Kudos
mariospapa
Beginner
1,173 Views
I'm using Module M2 in order to define Global Variables. The method that Les proposed worked.... You have to write (in the watch window) the module that variable belongs...

Thanks Les!


I have one more question:
Suppose the following

Module M1
Use M2
Contains

Subroutine SR1
Allocate vDataType(100)
Do i = 1, 100
Read(1,*) vDataType(i).fA, vDataType(i).fB, vDataType(i).fC
End Do
Call SR2
End Surboutine SR1

Subroutine SR2
iCounter = 0
Do = 1, 100
If (vDataType(i).fA == 1.0) Then
vDataType(i).fA = 0.0
Else
iCounter = iCounter + 1
vDataType(i).fA = iCounter
End If
End Do
End Subroutine SR2

End Module M1


Module M2
Type User
Integer :: fA, fB, fC
End Type User

Integer :: iCounter
Type(User), Allocatable :: vDataType (:)
End Module M2


When I build the solution writes an error in Output window saying:
"error #6837: The leftmost part-ref in a data-ref can not be a function reference. [VDATATYPE]"


and
"error #6158: The structure-name is invalid or is missing. [VDATATYPE]"

Why? How i can pass vDataType(:) values in Subroutine SR2?
0 Kudos
Les_Neilson
Valued Contributor II
1,173 Views
It should be % not "dot"

vDataType(i)%fa

Les
0 Kudos
Steven_L_Intel1
Employee
1,173 Views
mariospapa, I agree that % should be used rather than ., but ifort accepts either.

It is clear that you have retyped the source you posted as it contains several syntax errors. I often find that when users do this, the code they post isn't close enough to the actual code to show the problem. Please post actual code and then show it being compiled. When I fix the errors in your posted code, it compiles fine.
0 Kudos
Reply