| 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 |
| 10 |
|
| 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 |
| 15 |
|
| 16 |
subroutine test (order, values) |
| 17 |
integer, dimension (3:) :: values |
| 18 |
integer :: order, i |
| 19 |
|
| 20 |
if (size (values, dim = 1) .ne. order * 3) STOP 1 |
| 21 |
do i = 1, order |
| 22 |
if (values (i * 3) .ne. i) STOP 2 |
| 23 |
if (values (i * 3 + 1) .ne. i) STOP 3 |
| 24 |
if (values (i * 3 + 2) .ne. i * 2) STOP 4 |
| 25 |
end do |
| 26 |
end subroutine test |
| 27 |
end program main |