At the very end of a subroutine, I view the contents of a 3x40 array
with the Watch window. To do this, I type array(1:3,1:40). Then, I
return from the subroutine, and the contents are completely different.
After checking and double checking my arguments to make sure they
were declared consistently, I decided to print out the array contents
with WRITE statements. Lo and behold, there is no difference; the
array has the same contents before and after the return. I've also
checked the memory addresses of a few elements, and they are the same
as well.
Why is the Dev Studio debugger misleading me about the contents of the
array? I'd appreciate any enlightenment.
Yes, I've seen debugger a bit confused when displaying array elements,
especially when changing routine context. My speculation is that debugger
evaluates symbol "array" from the routine as *(SP+offset) where SP is
stack pointer; when the routine is exited, stack is cleared and there's
now garbage at that position, but VS does not refresh the contents. IIRC,
"collapsing" and then "expanding" the array in the Watch window fixes it.
It's better to point CVF-specific questions to Intel Developer Forum at
http://intel.forums.liveworld.com/forum.jsp?forum=76
--
Jugoslav
___________
www.geocities.com/jdujic
I noticed the same behaviour, and it made me panic, too.
One thing to do after returning from your subroutine is to click the
little "-" sign at he left of your array name, and then clicking the
"+" again to expand the array. The values shown for your array should
be the correct ones.
I don't know exactly why this happens, but I suppose this is due to
the fact that your arrays may be located at different places (stack,
heap..) in different subroutines. I'm not a computer expert, but it
should be something like that. The debugger shows the content of some
specific location, and when returning from a subroutine, the content
of this location has changed, because the memory is organized in a
different manner. Minimizing and expanding your array again causes the
debuggger to look up the new location of this array, and thus gives
you the correct values.
I repeat, the preceding paragraph is my personal interpretation....
Hope this helps
Pat