[gfortran,patch] More detailled runtime bounds-checking messages...

Tobias Burnus burnus@net-b.de
Fri Aug 10 09:48:00 GMT 2007


:REVIEWMAIL:

FX Coudert wrote:
> So now, I'm looking for a review to get this in, and eventually
> suggestions to change the wording if deemed inappropriate.
> Bootstrapped and regtested (both with and without -fbounds-check) on
> x86_64-linux, OK to commit?
The patch is OK.

In terms of wording (two files, one array (-4:5) accessed as a(1:-5:-1)
and the other a string len=5 a(2:6)):

NAG f95:
Subscript 1 of A (value -5) is out of range (-4:5)
Out of range: substring ending position 6 is greater than length 5

g95:
At line 4 of file b.f90 (Unit 6)
Fortran runtime error: Array section out of bounds
Fortran runtime error: Substring reference out of bounds: (2:6) in
string of length 5

ifort:
forrtl: severe (408): fort: (3): Subscript #1 of the array A has value
-5 which is less than the lower bound of -4
forrtl: severe (408): fort: (4): Variable A has substring ending point 6
which is greater than the variable length of 5

sunf95:
Subscript out of range. Location:  line 5 column 15 of 'a.f90'
Subscript number 1 has value -5 in array 'A'
Substring out of range. Location:  line 5 column 15 of 'b.f90'
The ending point has value 6 for substring of 'A'

gfortran (new):
At line 5 of file a.f90
Fortran runtime error: Array reference out of bounds, lower bound of
dimension 1 of array 'a' exceeded, -5 is smaller than -4
Fortran runtime error: Substring out of bounds: upper bound (6) of 'a'
exceeds string length (5)

gfortran contains all information (unless one wants to show both lower
and upper bound in the error message); I found none of the other ones
really superior.
One may argue whether "subscript" or "dimension" is the better word. I
have to admit that I like the one by NAG f95 as they are concise.

Tobias



More information about the Gcc-patches mailing list