view gcc/testsuite/gfortran.dg/do_subscript_3.f90 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
line wrap: on
line source

! { dg-do compile }
! PR fortran/91424
! Check that only one warning is issued inside blocks, and that
! warnings are also issued for contained subroutines.

program main
  real :: a(5)
  block
    integer :: j
    do j=0, 5  ! { dg-warning "out of bounds" }
       a(j) = 2. ! { dg-warning "out of bounds" }
    end do
  end block
  call x
contains
  subroutine x
    integer :: i
    do i=1,6 ! { dg-warning "out of bounds" }
       a(i) = 2.  ! { dg-warning "out of bounds" }
    end do
  end subroutine x
end program main