RISC-V: Do not inline when callee is versioned but caller is not
[official-gcc.git] / gcc / testsuite / gfortran.dg / do_1.f90
blobf98eb534847b76d1fb5128b9642c0a7c30cd23da
1 ! { dg-do run }
2 ! { dg-options "-Wall" }
3 ! Program to check corner cases for DO statements.
4 program do_1
5 implicit none
6 integer i, j
8 ! limit=HUGE(i), step > 1
9 j = 0
10 do i = HUGE(i) - 10, HUGE(i), 2
11 j = j + 1
12 end do
13 if (j .ne. 6) STOP 1
14 j = 0
15 do i = HUGE(i) - 9, HUGE(i), 2
16 j = j + 1
17 end do
18 if (j .ne. 5) STOP 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
25 ! Zero iterations
26 j = 0
27 do i = 1, 0, 1 ! { dg-warning "executed zero times" }
28 j = j + 1
29 end do
30 if (j .ne. 0) STOP 6
31 j = 0
32 do i = 1, 0, 2 ! { dg-warning "executed zero times" }
33 j = j + 1
34 end do
35 if (j .ne. 0) STOP 7
36 j = 0
37 do i = 1, 2, -1 ! { dg-warning "executed zero times" }
38 j = j + 1
39 end do
40 if (j .ne. 0) STOP 8
41 call test2 (0, 1)
42 call test2 (0, 2)
43 call test2 (2, -1)
44 call test2 (2, -2)
46 ! Bound near smallest value
47 j = 0;
48 do i = -HUGE(i), -HUGE(i), 10
49 j = j + 1
50 end do
51 if (j .ne. 1) STOP 9
52 contains
53 ! Returns the number of iterations performed.
54 function test1(r, step)
55 implicit none
56 integer test1, r, step
57 integer k, n
58 k = 0
59 do n = HUGE(n) - r, HUGE(n), step
60 k = k + 1
61 end do
62 test1 = k
63 end function
65 subroutine test2 (lim, step)
66 implicit none
67 integer lim, step
68 integer k, n
69 k = 0
70 do n = 1, lim, step
71 k = k + 1
72 end do
73 if (k .ne. 0) STOP 10
74 end subroutine
75 end program