Merge from mainline.
[official-gcc.git] / gcc / testsuite / gfortran.dg / array_constructor_10.f90
blobc439e0c7f7e93066a054901dec22c5c281bbbae5
1 ! Like array_constructor_6.f90, but check constructors that apply
2 ! an elemental function to an array.
3 ! { dg-do run }
4 program main
5 implicit none
6 call build (200)
7 contains
8 subroutine build (order)
9 integer :: order, i
11 call test (order, (/ (abs ((/ i, -i, -i * 2 /)), i = 1, order) /))
12 call test (order, abs ((/ ((/ -i, -i, i * 2 /), i = 1, order) /)))
13 call test (order, (/ abs ((/ ((/ i, i, -i * 2 /), i = 1, order) /)) /))
14 end subroutine build
16 subroutine test (order, values)
17 integer, dimension (3:) :: values
18 integer :: order, i
20 if (size (values, dim = 1) .ne. order * 3) call abort
21 do i = 1, order
22 if (values (i * 3) .ne. i) call abort
23 if (values (i * 3 + 1) .ne. i) call abort
24 if (values (i * 3 + 2) .ne. i * 2) call abort
25 end do
26 end subroutine test
27 end program main