2 ! { dg-options "-Wall" }
3 ! Program to check corner cases for DO statements.
8 ! limit=HUGE(i), step > 1
10 do i
= HUGE(i
) - 10, HUGE(i
), 2
15 do i
= HUGE(i
) - 9, HUGE(i
), 2
20 ! Same again, but unknown loop step
21 if (test1(10, 1) .ne
. 11) STOP 3
22 if (test1(10, 2) .ne
. 6) STOP 4
23 if (test1(9, 2) .ne
. 5) STOP 5
27 do i
= 1, 0, 1 ! { dg-warning "executed zero times" }
32 do i
= 1, 0, 2 ! { dg-warning "executed zero times" }
37 do i
= 1, 2, -1 ! { dg-warning "executed zero times" }
46 ! Bound near smallest value
48 do i
= -HUGE(i
), -HUGE(i
), 10
53 ! Returns the number of iterations performed.
54 function test1(r
, step
)
56 integer test1
, r
, step
59 do n
= HUGE(n
) - r
, HUGE(n
), step
65 subroutine test2 (lim
, step
)