OSDN Git Service

2010-11-13 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / array_constructor_6.f90
1 ! PR 12840.  Make sure that array constructors can be used to determine
2 ! the bounds of a scalarization loop.
3 ! { dg-do run }
4 program main
5   implicit none
6   call build (11)
7 contains
8   subroutine build (order)
9     integer :: order, i
10
11     call test (order, (/ (i * 2, i = 1, order) /))
12     call test (17, (/ (i * 2, i = 1, 17) /))
13     call test (5, (/ 2, 4, 6, 8, 10 /))
14   end subroutine build
15
16   subroutine test (order, values)
17     integer, dimension (:) :: values
18     integer :: order, i
19
20     if (size (values, dim = 1) .ne. order) call abort
21     do i = 1, order
22       if (values (i) .ne. i * 2) call abort
23     end do
24   end subroutine test
25 end program main