Retro68/gcc/gcc/testsuite/gfortran.dg/do_corner_warn.f90
2018-12-28 16:30:48 +01:00

23 lines
492 B
Fortran

! { dg-options "-Wundefined-do-loop" }
! Program to check corner cases for DO statements.
program do_1
implicit none
integer i, j
! limit=HUGE(i), step 1
j = 0
do i = HUGE(i) - 10, HUGE(i), 1 ! { dg-warning "is undefined as it overflows" }
j = j + 1
end do
if (j .ne. 11) STOP 1
! limit=-HUGE(i)-1, step -1
j = 0
do i = -HUGE(i) + 10 - 1, -HUGE(i) - 1, -1 ! { dg-warning "is undefined as it underflows" }
j = j + 1
end do
if (j .ne. 11) STOP 2
end program