1! { dg-do run }
2
3module e_51_1_mod
4contains
5  subroutine init (v1, v2, N)
6    integer :: i, N
7    real :: v1(N), v2(N)
8    do i = 1, N
9      v1(i) = i + 2.0
10      v2(i) = i - 3.0
11    end do
12  end subroutine
13
14  subroutine check (p, N)
15    integer :: i, N
16    real, parameter :: EPS = 0.00001
17    real :: diff, p(N)
18    do i = 1, N
19      diff = p(i) - (i + 2.0) * (i - 3.0)
20      if (diff > EPS .or. -diff > EPS) stop 1
21    end do
22  end subroutine
23
24  subroutine vec_mult (N)
25    real :: p(N), v1(N), v2(N)
26    integer :: i, N
27    call init (v1, v2, N)
28    !$omp target data map(to: v1, v2) map(from: p)
29      !$omp target
30        !$omp parallel do
31        do i = 1, N
32          p(i) = v1(i) * v2(i)
33        end do
34      !$omp end target
35    !$omp end target data
36    call check (p, N)
37  end subroutine
38end module
39
40program e_51_1
41  use e_51_1_mod, only : vec_mult
42  integer :: n
43  n = 1000
44  call vec_mult (n)
45end program
46