FORTRAN Reference Manual
Compiler Directives
FORTRAN Reference Manual—528615-001
10-8
BOUNDSCHECK Compiler Directive
•
Specify the ANSI directive either with the FORTRAN command, or in the source
input file preceding the first FORTRAN statement, or between the END line of one
program unit and the first FORTRAN statement of the next program unit.
•
The ANSI compiler directive is equivalent to COLUMNS 72, with the following
exceptions:
°
If you specify ANSI, the compiler truncates or pads (with blanks) each source
line to make it exactly 72 characters. The COLUMNS directive makes the
compiler ignore all source text beyond the specified number of characters, but
it does not affect source lines shorter than 72 characters. This distinction can
be important if any character constants are continued from one line to the next.
°
The SOURCE and SECTION directives do not affect the ANSI mode.
•
The ANSI directive temporarily overrides the effects of any COLUMNS directives.
•
When an ANSI directive is in effect, the compiler prints each source-line image with
a vertical bar character between the last character of a line and the first ignored
character of that line. In other words, the compiler prints a vertical bar between
columns 72 and 73 of each source-line image.
Example
?ANSI
BOUNDSCHECK Compiler Directive
The BOUNDSCHECK directive causes FORTRAN to generate code that verifies at run
time that all array subscripts are within the lower and upper bounds declared for arrays
dimensioned in the program.
The default value is NOBOUNDSCHECK.
Considerations
•
Array bounds violations cause arithmetic overflow at execution time. If you specify
NOBOUNDSCHECK or omit this specification, the compiler does not perform any
verification.
•
You must compile each program unit in its entirety either with bounds checking or
without.
•
BOUNDSCHECK decreases program performance because of the additional code
required to check each reference to an element of an array.
•
Specify the BOUNDSCHECK directive either with the FORTRAN command, or in
the source input file preceding the first FORTRAN statement, or between the END
[NO]BOUNDSCHECK










