This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran,patch] Improve error messages for bounds-checking and a few other cases


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]