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

            Bug ID: 94978
           Summary: [8/9/10/11 Regression] Bogus warning "Array reference
                    at (1) out of bounds in loop beginning at (2)"
           Product: gcc
           Version: 8.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: foreese at gcc dot gnu.org
  Target Milestone: ---

Created attachment 48472
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48472&action=edit
Testcase which exhibits the regression

The following issues a bogus warning which cannot be disabled except with -w.
The warning is not present in 7.x or earlier. Tried with 8.4.1, 9.3.1, 10 and
11.x (current trunk). Attached is a simple test case, which builds Pascal's
triangle of order 8 and exhibits the regression.

$ gfortran pascal.f03
pascal.f03:13:25:

   10 | do i = 0, 8
      |           2              
......
   13 |     pascal(i,j) = pascal(i-1,j) + pascal(i-1,j-1)
      |                         1
Warning: Array reference at (1) out of bounds (-1 < 0) in loop beginning at (2)
pascal.f03:13:41:

   10 | do i = 0, 8
      |           2                              
......
   13 |     pascal(i,j) = pascal(i-1,j) + pascal(i-1,j-1)
      |                                         1
Warning: Array reference at (1) out of bounds (-1 < 0) in loop beginning at (2)

Reply via email to