1! { dg-do run }
2! { dg-additional-options "-msse2" { target sse2_runtime } }
3! { dg-additional-options "-mavx" { target avx_runtime } }
4
5  type dt
6    integer :: x = 0
7  end type
8  type (dt) :: t
9  integer :: i, j, k, l, r, s, a(30)
10  integer, target :: q(30)
11  integer, pointer :: p(:)
12  !$omp declare reduction (foo : integer : &
13  !$omp & omp_out = omp_out + omp_in) initializer (omp_priv = 0)
14  !$omp declare reduction (+ : dt : omp_out%x = omp_out%x &
15  !$omp & + omp_in%x)
16  a(:) = 1
17  q(:) = 1
18  p => q
19  r = 0
20  j = 10
21  k = 20
22  s = 0
23  !$omp simd safelen (8) reduction(+:r, t) linear(j, k : 2) &
24  !$omp& private (l) aligned(p : 4) reduction(foo:s)
25  do i = 1, 30
26    l = j + k + a(i) + p(i)
27    r = r + l
28    j = j + 2
29    k = k + 2
30    s = s + l
31    t%x = t%x + l
32  end do
33  if (r.ne.2700.or.j.ne.70.or.k.ne.80.or.s.ne.2700) call abort
34  if (t%x.ne.2700) call abort
35end
36