https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87606

            Bug ID: 87606
           Summary: Wrong array reference out of bounds warning
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: AstroFloyd at gmail dot com
  Target Milestone: ---

The following Fortran program (minimum working example) gives an erroneous
array reference out of bounds warning:

program test
  implicit none
  integer :: i,iarr(10)
  do i=1,10
     if(i.gt.1) iarr(i-1) = i
  end do
end program test


$ gfortran -Wdo-subscript test.f90 -o test
test.f90:5:21:

   do i=1,10
           2          
      if(i.gt.1) iarr(i-1) = i
                     1
Warning: Array reference at (1) out of bounds (0 < 1) in loop beginning at (2)
[-Wdo-subscript]

Reply via email to