Next: Array Inquiry Intrinsics
Up: Arrays
Previous: Array I/O Example
Attempting to operate past the end of an array is a common error:
- subscript references must lie within the declared bounds,
- compilers rarely check by default,
- can use switch for example, -CB on the EPC
compiler, -C on the NAg compiler,
- checking is expensive, use sparingly.
The following example demonstrates a possible bound violation (if
M ):
REAL, DIMENSION(50) :: A
...
DO I=1,M
A(I) = A(I-1) + 1.0 ! refs A(0)
END DO
For more information, click here
Next: Array Inquiry Intrinsics
Up: Arrays
Previous: Array I/O Example
©University of Liverpool, 1997
Wed May 28 23:37:18 BST 1997Not for commercial use.