This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [gfortran,patch] Improve error messages for bounds-checking and a few other cases
- From: Tobias Burnus <burnus at net-b dot de>
- To: fortran at gcc dot gnu dot org
- Date: Wed, 07 Jun 2006 10:40:00 +0200
- Subject: Re: [gfortran,patch] Improve error messages for bounds-checking and a few other cases
- References: <31A70158-7AE3-4C92-9F70-4C54B9767541@gmail.com>
Hello,
FX Coudert wrote:
> Attached patch yields detailed error messages with -fbounds-check.
Thanks a lot.
> A sample of the error messages is:
>
>> $ cat a1.f90
>> integer x(1,1)
>> x(1,2) = 1
>> end
>> $ gfortran -fbounds-check a1.f90 -w && ./a.out
>> Fortran runtime error: Array reference out of bounds for array 'x',
>> upper bound of dimension 2 exceeded (in file 'a1.f90', at line 2)
Could you also state which exect index was used (and maybe the
maximal/minimal allowed index)? In some more complicated programs it
helps to find the error. This is what other compilers are doing:
NAG: Subscript 2 of X (value 2) is out of range (1:1)
Ifort: Subscript #2 of the array X has value 2 which is greater than the
upper bound of 1
> I hope you think, like me, that it's better than the current error
> message: "Fortran runtime error: Array bound mismatch", with no source
> file, line and variable name :)
It's definitly better :-)
Tobias