Sun Studio 12: Fortran Programming Guide

5.2.1 Subscript Bounds (–C)

If you compile with -C, the compiler adds checks at runtime for out-of-bounds references on each array subscript, and array conformance. This action helps catch some situations that cause segmentation faults.

Example: Index out of range:


demo% cat range.f
      REAL a(10,10)
      k = 11
      a(k,2) = 1.0
      END
demo% f95 -o range range.f
demo% range

 ******  FORTRAN RUN-TIME SYSTEM  ******
Subscript out of range. Location: line 3 column 9 of ’range.f’
Subscript number 1 has value 11 in array ’A’
Abort
demo%