Merged with mainline at revision 128810.
[official-gcc.git] / gcc / testsuite / gfortran.dg / array_constructor_12.f90
blob082e90ecc0d387eb57f693396362254cb41a7919
1 ! Like array_constructor_6.f90, but check integer(8) iterators.
2 ! { dg-do run }
3 program main
4 integer (kind = 8) :: i, l8, u8, step8
5 integer (kind = 4) :: l4, step4
6 integer (kind = 8), parameter :: big = 10000000000_8
8 l4 = huge (l4)
9 u8 = l4 + 10_8
10 step4 = 2
11 call test ((/ (i, i = l4, u8, step4) /), l4 + 0_8, u8, step4 + 0_8)
13 l8 = big
14 u8 = big * 20
15 step8 = big
16 call test ((/ (i, i = l8, u8, step8) /), l8, u8, step8)
18 u8 = big + 100
19 l8 = big
20 step4 = -20
21 call test ((/ (i, i = u8, l8, step4) /), u8, l8, step4 + 0_8)
23 u8 = big * 40
24 l8 = big * 20
25 step8 = -big * 2
26 call test ((/ (i, i = u8, l8, step8) /), u8, l8, step8)
28 u8 = big
29 l4 = big / 100
30 step4 = -big / 500
31 call test ((/ (i, i = u8, l4, step4) /), u8, l4 + 0_8, step4 + 0_8)
33 u8 = big * 40 + 200
34 l4 = 200
35 step8 = -big
36 call test ((/ (i, i = u8, l4, step8) /), u8, l4 + 0_8, step8)
37 contains
38 subroutine test (a, l, u, step)
39 integer (kind = 8), dimension (:), intent (in) :: a
40 integer (kind = 8), intent (in) :: l, u, step
41 integer (kind = 8) :: i
42 integer :: j
44 j = 1
45 do i = l, u, step
46 if (a (j) .ne. i) call abort
47 j = j + 1
48 end do
49 if (size (a, 1) .ne. j - 1) call abort
50 end subroutine test
51 end program main