In the following subroutine "findphase", the upper bound of the second
dimension of "jp" is not known. Using -fbounds-check:

Fortran runtime error: Array reference out of bounds, upper bound of dimension
2 of array 'jp' exceeded, 2 is greater than 0


 implicit none
 integer, parameter :: maxss=7,maxc=8
 integer :: jp(2,maxc)
 call findphase(jp)
contains
  subroutine findphase(jp)
    integer, intent(out) :: jp(2,*)
    jp(2,2:4)=0
  end subroutine
end

>From the dump, one sees that the error is printed unconditionally and twice.

findphase (jp)
{
  _gfortran_runtime_error_at (&"At line 8 of file a.f90"[1]{lb: 1 sz: 1},
&"Array reference out of bounds, upper bound of dimension 2 of array \'jp\'
exceeded, %ld is greater than %ld"[1]{lb: 1 sz: 1}, 2, 0);
  _gfortran_runtime_error_at (&"At line 8 of file a.f90"[1]{lb: 1 sz: 1},
&"Array reference out of bounds, upper bound of dimension 2 of array \'jp\'
exceeded, %ld is greater than %ld"[1]{lb: 1 sz: 1}, 4, 0);
[...]


-- 
           Summary: -fbounds-check: Bogus out-of-bounds run-time error for
                    assumed-size array
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 27766
             nThis:


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

Reply via email to