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
13 if (j
.ne
. 6) call abort
15 do i
= HUGE(i
) - 9, HUGE(i
), 2
18 if (j
.ne
. 5) call abort
20 ! Same again, but unknown loop step
21 if (test1(10, 1) .ne
. 11) call abort
22 if (test1(10, 2) .ne
. 6) call abort
23 if (test1(9, 2) .ne
. 5) call abort
27 do i
= 1, 0, 1 ! { dg-warning "executed zero times" }
30 if (j
.ne
. 0) call abort
32 do i
= 1, 0, 2 ! { dg-warning "executed zero times" }
35 if (j
.ne
. 0) call abort
37 do i
= 1, 2, -1 ! { dg-warning "executed zero times" }
40 if (j
.ne
. 0) call abort
46 ! Bound near smallest value
48 do i
= -HUGE(i
), -HUGE(i
), 10
51 if (j
.ne
. 1) call abort
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
)
73 if (k
.ne
. 0) call abort