2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / array_constructor_7.f90
blob65ec26c8750b7922569fbb31ce3b8194981249ef
1 ! Like array_constructor_6.f90, but test for nested iterators.
2 ! { dg-do run }
3 program main
4 implicit none
5 call build (17)
6 contains
7 subroutine build (order)
8 integer :: order, i, j
10 call test (order, (/ (((j + 100) * i, j = 1, i), i = 1, order) /))
11 call test (9, (/ (((j + 100) * i, j = 1, i), i = 1, 9) /))
12 call test (3, (/ 101, 202, 204, 303, 306, 309 /))
13 end subroutine build
15 subroutine test (order, values)
16 integer, dimension (:) :: values
17 integer :: order, i, j
19 if (size (values, dim = 1) .ne. order * (order + 1) / 2) call abort
20 do i = 1, order
21 do j = 1, i
22 if (values (i * (i - 1) / 2 + j) .ne. (j + 100) * i) call abort
23 end do
24 end do
25 end subroutine test
26 end program main