CONTAINS statement

CONTAINS statement

I can locate a Break Point in an Internal Procedure but cannot get variable values either by running mouse cursor over variable or in Watch windows in Visual Studio. Internal Procedure appears to work, just can't debug normally. The Internal Procedure uses two global variables that are associated with a USE MODELGlobals in the host routine.Must be doing something wrong, but haven't been able to figure out what the problem is. Code follows, and any comments would be appreciated.

SUBROUTINE DIAminmax(Jmin, Jmax, Wake, iError)

! USE ifwin included in MODELGlobals


INTEGER(4) iret
INTEGER(4) iErr, iError

REAL Dia_min, Dia_max
REAL Jmax, Jmin
REAL Wake ! Wake is not global
REAL Const

CHARACTER(giCharLen) cDia


! rangle of possible diameters
Dia_max = (MPH*Wake*1.46667*60.0*Gear_Ratio)/(Jmin*RPM)
Dia_min = Dia_max*(Jmin/Jmax)
.... ! calculate Dia_minDia_max here

if(Dia .LT. Dia_min) then

Dia = CEILING(Dia_min*100.0)/100.0

iError = Update() ! internal procedure

else if(Dia .GT. Dia_max) then

Dia = FLOOR(Dia_max*100.0)/100.0

iError = Update()

else if(bDiaChng) then

iError = Update()

end if

iError = 1



! * Dia and gszDia are Global Variables
! * see USE MODELGlobals above

write(cDia, '(F5.2)', IOSTAT=iErr) Dia

read(cDia, '(F5.2)', IOSTAT=iErr) Dia

cDia = ADJUSTL(cDia)

gszDia = cDia(1:5)//ACHAR(0)

iret = SetWindowText(ghDIA, gszDia)

Update = 1



13 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

No, you're not doing anything wrong. It's a known problem that host-associated variables are not viewable in the debugger. It is something we're working on. Sorry for the inconvenience.

You may be able to add a watch of modname::varname for the variables in the module.

Retired 12/31/2016

Thanks for the quick reply and info.

You can use the scope operator (::) as Steve suggests or if you do not like typing that in then simply declare and use a local pointer.

real, pointer :: pDia
pDia => Dia

You can make that work around code conditional compile. Pick an explanitory name such as DEBUG_REQUIRES_SCOPE_HACK. Define this in a general include file. Then when the compiler is fixed you can try the code out by not defining the symbol. Keep the code in for a few updates of the compiler just in case the fix is un-fixed (or if you port your code to a system that is running an older version of the compiler).

Jim Dempsey

Thanks again Jim for the helpful information.

I am having this same problem using VS .NET 2005. I'm using the latest version of the Intel compiler. Has this problem not been fixed?

It has not, but it is actively being investigated. It is not a simple problem to solve.

I urge anyone who has encountered this problem to report it to Intel Premier Support. It will help ensure that you obtain a fix as soon as it is available.

Retired 12/31/2016

Has this problem ever been solved?  I am using VS 2008 & Fortran Visual Composer XE 2013.




Hi Dave

I believe it hasn't been since I still see it. One way to look at the variable values is to go to the calling routine through call-stack. This is, obviously, irritating to say the least but your don't need to declare local pointers and then delete them after debugging.


Hi Abhi,

Thank you for the response, but I am not sure what you are suggesting I do.  Suppose I am debugging a contains procedure and want to look at the value of a variable.  What exactly do I do?




Hi Dave

In the debugging session, check your call-stack window. By clicking on the call from the parent procedure, you can go in that frame. The value of the variable will be available in the watch window and by hovering mouse over it. I have attached two snapshots and one screen-capture movie. I hope this is what you are looking for.


Hi Dave

Somehow the file upload did not go through the last time. Putting in the snapshots again.



Downloadimage/png stack1.png108.04 KB
Downloadimage/png stack2.png94.26 KB


Thank you; this is a HUGE help!



Leave a Comment

Please sign in to add a comment. Not a member? Join today