1subroutine foo()
2implicit none
3integer :: i, r
4!$omp taskloop reduction(task, +: r)  ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
5do i = 1, 64
6end do
7!$omp taskloop simd reduction(task, +: r)  ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
8do i = 1, 64
9end do
10!$omp master taskloop reduction(task, +: r)  ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
11do i = 1, 64
12end do
13!$omp master taskloop simd reduction(task, +: r)  ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
14do i = 1, 64
15end do
16!$omp parallel master taskloop reduction(task, +: r)  ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
17do i = 1, 64
18end do
19!$omp parallel master taskloop simd reduction(task, +: r)  ! { dg-error "Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
20do i = 1, 64
21end do
22
23!$omp taskloop reduction(inscan, +: r)  ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
24do i = 1, 64                            ! { dg-error "OMP SCAN between two structured-block-sequences" "" { target *-*-* } .-1 }
25end do
26!$omp taskloop simd reduction(inscan, +: r)  ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
27do i = 1, 64                                 ! { dg-error "OMP SCAN between two structured-block-sequences" "" { target *-*-* } .-1 }
28end do
29!$omp master taskloop reduction(inscan, +: r) ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
30do i = 1, 64
31end do
32!$omp master taskloop simd reduction(inscan, +: r)  ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
33do i = 1, 64
34end do
35!$omp parallel master taskloop reduction(inscan, +: r)  ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
36do i = 1, 64                                 ! { dg-error "OMP SCAN between two structured-block-sequences" "" { target *-*-* } .-1 }
37end do
38!$omp parallel master taskloop simd reduction(inscan, +: r)   ! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" }
39do i = 1, 64                                 ! { dg-error "OMP SCAN between two structured-block-sequences" "" { target *-*-* } .-1 }
40end do
41end
42
43
44subroutine bar()
45implicit none
46integer :: i, r
47r = 0
48!$omp parallel reduction(+:r)
49  !$omp master taskloop in_reduction(+:r)
50    do i = 1, 64
51    end do
52  !$omp master taskloop simd in_reduction(+:r)
53    do i = 1, 64
54    end do
55  !$omp master
56    !$omp taskloop in_reduction(+:r)
57      do i = 1, 64
58      end do
59    !$omp taskloop simd in_reduction(+:r)
60      do i = 1, 64
61      end do
62  !$omp end master
63!$omp end parallel
64
65!$omp parallel master taskloop in_reduction(+:r)  ! { dg-error "Failed to match clause" }
66    do i = 1, 64
67    end do
68
69!$omp parallel master taskloop simd in_reduction(+:r)  ! { dg-error "Failed to match clause" }
70    do i = 1, 64
71    end do
72end
73