2 ! Program to check corner cases for DO statements.
7 ! limit=HUGE(i), step 1
9 do i
= HUGE(i
) - 10, HUGE(i
), 1
12 if (j
.ne
. 11) call abort
13 ! limit=HUGE(i), step > 1
15 do i
= HUGE(i
) - 10, HUGE(i
), 2
18 if (j
.ne
. 6) call abort
20 do i
= HUGE(i
) - 9, HUGE(i
), 2
23 if (j
.ne
. 5) call abort
25 ! Same again, but unknown loop step
26 if (test1(10, 1) .ne
. 11) call abort
27 if (test1(10, 2) .ne
. 6) call abort
28 if (test1(9, 2) .ne
. 5) call abort
32 do i
= 1, 0, 1 ! { dg-warning "executed zero times" }
35 if (j
.ne
. 0) call abort
37 do i
= 1, 0, 2 ! { dg-warning "executed zero times" }
40 if (j
.ne
. 0) call abort
42 do i
= 1, 2, -1 ! { dg-warning "executed zero times" }
45 if (j
.ne
. 0) call abort
51 ! Bound near smallest value
53 do i
= -HUGE(i
), -HUGE(i
), 10
56 if (j
.ne
. 1) call abort
58 ! Returns the number of iterations performed.
59 function test1(r
, step
)
61 integer test1
, r
, step
64 do n
= HUGE(n
) - r
, HUGE(n
), step
70 subroutine test2 (lim
, step
)
78 if (k
.ne
. 0) call abort