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
), 1
13 if (j
.ne
. 11) call abort
14 ! limit=HUGE(i), step > 1
16 do i
= HUGE(i
) - 10, HUGE(i
), 2
19 if (j
.ne
. 6) call abort
21 do i
= HUGE(i
) - 9, HUGE(i
), 2
24 if (j
.ne
. 5) call abort
26 ! Same again, but unknown loop step
27 if (test1(10, 1) .ne
. 11) call abort
28 if (test1(10, 2) .ne
. 6) call abort
29 if (test1(9, 2) .ne
. 5) call abort
33 do i
= 1, 0, 1 ! { dg-warning "executed zero times" }
36 if (j
.ne
. 0) call abort
38 do i
= 1, 0, 2 ! { dg-warning "executed zero times" }
41 if (j
.ne
. 0) call abort
43 do i
= 1, 2, -1 ! { dg-warning "executed zero times" }
46 if (j
.ne
. 0) call abort
52 ! Bound near smallest value
54 do i
= -HUGE(i
), -HUGE(i
), 10
57 if (j
.ne
. 1) call abort
59 ! Returns the number of iterations performed.
60 function test1(r
, step
)
62 integer test1
, r
, step
65 do n
= HUGE(n
) - r
, HUGE(n
), step
71 subroutine test2 (lim
, step
)
79 if (k
.ne
. 0) call abort