- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my program, I have 3 files for Main program, module var and module step1
Program Main
Use Var
Use Step1
Implicit none
Call Step1Sub
end program Main
Module Var
REAL(8), Dimension(1:5) :: A, B, C
Contains
Pure Function AInverse (A)
Real(8) :: AInverse
Real(8), Intent(In) :: A
AInverse = 1.0D0/A
End Function AInverse
END Module Var
Module Step1
Use Var
Implicit None
Contains
Subroutine Step1Sub
Integer :: i
A = 1.0D0
B(1:) = 5.0D0
ForAll (i = 1:5)
C(i) = AInverse(10.0D0)
End ForAll
End Subroutine Step1Sub
End Module Step1
During the debugging process of this program, I cannot see the value of B and C. I can see only the value of A.
If I print out the value of A, B, and C, then I get the correct answer.
Can anybody tell me why sometimes Fortran doesnt recognize my variable (B & C) during the debugging? (when I add B & C to a watch parameter during debugging, the value are undefined but I can see A values)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A is also available globally in Module Var. However, while within AInverse, the A you are looking at is the local variable, not the one in Var. (Since A is a dummy argument, you could rename all of the A's in AInverse to Z without any change to the program.
If you did this, you could find inside AInverse, you cannot access any of A,B, C.
I suggest you try using the module::variable syntax to look at the variables, i.e. Var::A, Var::B and Var::C.
Regards,
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there any way that I can take a look at module variable during debugging without type this syntax in an immediate window? something like module variable window?
what I did in my program normally is to set all variable equal to 0 in one subroutine that call from the main program. I found that if I use A = 0.0 in one subroutine that is called from the main program (or use this in main program) then I can see the variable during debugging. but if I use Forall or index then I cannot see the module variable during debugging. When I did this even though I can see those variable during debugging but my program run slower

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page