[Bug fortran/31270] New: print subscript value and array bounds when out-of-bounds error occurs

vivekrao4 at yahoo dot com gcc-bugzilla@gcc.gnu.org
Mon Mar 19 22:02:00 GMT 2007


For the code

program xcheck
implicit none
integer :: i,ivec(2)
ivec = 0
do i=1,3
   if (i**2 < 10) print*,ivec(i)
end do
end program xcheck

gfortran -Wall -fbounds-check

for mingw 4.3.0 20070315

gives at run time

Fortran runtime error: Array reference out of bounds for array 'ivec', upper
bound of dimension 1 exceeded (in file 'xbounds_check.f90', at line 6)
           0
           0

This is good, but g95 is a little more informative, identifyng the value of the
out-of-bound subscript and the relevant dimension of the array, saying

 0
 0
At line 6 of file xbounds_check.f90 (Unit 6)
Traceback: not available, compile with -ftrace=frame or -ftrace=full
Fortran runtime error: Array element out of bounds: 3 in (1:2), dim=1

Vivek Rao


-- 
           Summary: print subscript value and array bounds when out-of-
                    bounds error occurs
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vivekrao4 at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31270



More information about the Gcc-bugs mailing list