1! { dg-do compile }
2
3subroutine f1
4!$omp declare reduction (.le.:integer:omp_out = omp_out + omp_in) ! { dg-error "Invalid operator for" }
5end subroutine f1
6subroutine f2
7!$omp declare reduction (bar:real(kind=4):omp_out = omp_out + omp_in)
8  real(kind=4) :: r
9  integer :: i
10  r = 0.0
11!$omp parallel do reduction (bar:r)
12  do i = 1, 10
13    r = r + i
14  end do
15!$omp parallel do reduction (foo:r) ! { dg-error "foo not found" }
16  do i = 1, 10
17    r = r + i
18  end do
19!$omp parallel do reduction (.gt.:r) ! { dg-error "cannot be used as a defined operator" }
20  do i = 1, 10
21    r = r + i
22  end do
23end subroutine f2
24subroutine f3
25!$omp declare reduction (foo:blah:omp_out=omp_out + omp_in) ! { dg-error "Unclassifiable OpenMP directive" }
26end subroutine f3
27subroutine f4
28!$omp declare reduction (foo:integer:a => null()) ! { dg-error "Invalid character in name" }
29!$omp declare reduction (foo:integer:omp_out = omp_in + omp_out) &
30!$omp & initializer(a => null()) ! { dg-error "Invalid character in name" }
31end subroutine f4
32subroutine f5
33  integer :: a, b
34!$omp declare reduction (foo:integer:a = b + 1) ! { dg-error "Variable other than OMP_OUT or OMP_IN used in combiner" }
35!$omp declare reduction (bar:integer:omp_out = omp_out * omp_in) &
36!$omp & initializer(b = a + 1) ! { dg-error "Variable other than OMP_PRIV or OMP_ORIG used in INITIALIZER clause" }
37end subroutine f5
38subroutine f6
39!$omp declare reduction (foo:integer:omp_out=omp_out+omp_in) &
40!$omp & initializer(omp_orig=omp_priv)
41end subroutine f6
42