1! { dg-do run }
2! { dg-additional-options "-O2" }
3! { dg-additional-options "-ftree-parallelize-loops=2" }
4
5! Variable bound, vector addition.
6
7subroutine foo (nr)
8  integer, intent(in) :: nr
9  integer, parameter :: n = 1000
10  integer, dimension (0:n-1) :: a, b, c
11  common a, b, c
12  integer :: ii
13
14  do ii = 0, nr - 1
15     c(ii) = a(ii) + b(ii)
16  end do
17end subroutine foo
18
19program main
20  integer, parameter :: n = 1000
21  integer, parameter :: distrib = 10
22  integer, dimension (0:n-1) :: a, b, c
23  common a, b, c
24  integer :: i, j, k
25
26  do j = 0, ((n / distrib) -1)
27     do i = 0, distrib - 1
28	k = i + (distrib * j)
29	a(k) = k
30	b(k) = MODULO ((k * 3), 7)
31	c(k) = k * 2;
32     end do
33  end do
34
35  call foo (n)
36
37  do i = 0, n - 1
38     if (c(i) .ne. (i + MODULO ((i * 3), 7))) call abort
39  end do
40
41end program
42