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

Debugger watch window subscript out of range

david_c_7
Beginner
380 Views

I'm debugging a program which is set up to reference memory locations outside the range of the dimension of various variables. Program is compiled so subscripts are not checked for range, but when I use the debugger an try to look at the variable in a watch window, I always get a 'subscript out of range' when I use a subscript that I know gives me the location of the information I want to see. Is there any way to keep the watch window from checking on the subscript of a variable?

0 Kudos
2 Replies
mecej4
Honored Contributor III
380 Views

The subscript checking that you mention is limited in scope, and probably catches obvious out-of-range subscripts, such as when you enter X(6) as a variable to watch when X is declared with a subscript range of 1:5. However, you can easily overcome this limitation by assigning a value such as 6 to a subscript variable, say, i=6, and entering X(i) as the watched variable. I enclose a screenshot to illustrate this.

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
380 Views

You can also use the Memory window to display the array starting at (say) the last specified index (keeping the debugger happy), then pick the format (char, short, int (4) int (8), real(4), real(8)) and then scroll down as far as you want to go. The only disadvantage of this is addresses show up in hex. But this is a good way to check to see if something overwritten its bounds.

Jim Dempsey

0 Kudos
Reply