More about bounds checking

More about bounds checking

In this test program, I can input a negative row number,

and it happily does not care whether its within the bounds

of the array A (in the calling routine), but then when I input a

negative COLUMN number, it generates a breakpoint.

Notice that I can print out quantities that are OUTSIDE the calling

routine array A, just by giving a large number of columns or rows.

Anyway, isn't it supposed to do bounds checking on BOTH columns and rows?

A negative row number is this context should be caught shouldn't it?

Downloadapplication/octet-stream test16.f90432 bytes
3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I think you have your row and column designations backward from usual Fortran convention.  The bounds checking probably doesn't care if you stay inside the array even though you exceed one of the subscripts, as it has to allow the case where a multiple dimensioned array is accessed as single dimensioned.

When you say *, it's up to you to make sure you don't go out of bounds. The compiler has no idea what the actual bounds are.  This is why you should use : (and explicit interfaces) instead.

Retired 12/31/2016

Leave a Comment

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