| 1 |
module m |
| 2 |
integer a, b |
| 3 |
end module m |
| 4 |
|
| 5 |
subroutine f1 |
| 6 |
use m |
| 7 |
!$omp scan inclusive (a) ! { dg-error "Unexpected ..OMP SCAN at .1. outside loop construct with 'inscan' REDUCTION clause" } |
| 8 |
!$omp scan exclusive (b) ! { dg-error "Unexpected ..OMP SCAN at .1. outside loop construct with 'inscan' REDUCTION clause" } |
| 9 |
end |
| 10 |
|
| 11 |
subroutine f2 (c, d, e, f) |
| 12 |
use m |
| 13 |
implicit none |
| 14 |
integer i, l, c(*), d(*), e(64), f(64) |
| 15 |
l = 1 |
| 16 |
|
| 17 |
!$omp do reduction (inscan, +: a) reduction (+: b) ! { dg-error "'inscan' and non-'inscan' 'reduction' clauses on the same construct" } |
| 18 |
do i = 1, 64 |
| 19 |
block |
| 20 |
b = b + 1 |
| 21 |
a = a + c(i) |
| 22 |
end block |
| 23 |
!$omp scan inclusive (a) |
| 24 |
d(i) = a |
| 25 |
end do |
| 26 |
|
| 27 |
!$omp do reduction (+: a) reduction (inscan, +: b) ! { dg-error "'inscan' and non-'inscan' 'reduction' clauses on the same construct" } |
| 28 |
do i = 1, 64 |
| 29 |
block |
| 30 |
a = a + 1 |
| 31 |
b = b + c(i) |
| 32 |
end block |
| 33 |
!$omp scan inclusive (b) |
| 34 |
d(i) = b |
| 35 |
end do |
| 36 |
|
| 37 |
!$omp do reduction (inscan, +: e) |
| 38 |
do i = 1, 64 |
| 39 |
block |
| 40 |
e(1) = e(1) + c(i) |
| 41 |
e(2) = e(2) + c(i) |
| 42 |
end block |
| 43 |
!$omp scan inclusive (a, e) |
| 44 |
block |
| 45 |
d(1) = e(1) |
| 46 |
f(2) = e(2) |
| 47 |
end block |
| 48 |
end do |
| 49 |
|
| 50 |
!$omp do reduction (inscan, +: e(:2)) ! { dg-error "Syntax error in OpenMP variable list" } |
| 51 |
do i = 1, 64 |
| 52 |
block |
| 53 |
e(1) = e(1) + c(i) |
| 54 |
e(2) = e(2) + c(i) |
| 55 |
end block |
| 56 |
!$omp scan inclusive (a, e) ! { dg-error "outside loop construct with 'inscan' REDUCTION clause" } |
| 57 |
block |
| 58 |
d(1) = e(1) |
| 59 |
f(2) = e(2) |
| 60 |
end block |
| 61 |
end do |
| 62 |
|
| 63 |
!$omp do reduction (inscan, +: a) ordered ! { dg-error "ORDERED clause specified together with 'inscan' REDUCTION clause" } |
| 64 |
do i = 1, 64 |
| 65 |
a = a + c(i) |
| 66 |
!$omp scan inclusive (a) |
| 67 |
d(i) = a |
| 68 |
end do |
| 69 |
|
| 70 |
!$omp do reduction (inscan, +: a) ordered(1) ! { dg-error "ORDERED clause specified together with 'inscan' REDUCTION clause" } |
| 71 |
do i = 1, 64 |
| 72 |
a = a + c(i) |
| 73 |
!$omp scan inclusive (a) |
| 74 |
d(i) = a |
| 75 |
end do |
| 76 |
|
| 77 |
!$omp do reduction (inscan, +: a) schedule(static) ! { dg-error "SCHEDULE clause specified together with 'inscan' REDUCTION clause" } |
| 78 |
do i = 1, 64 |
| 79 |
a = a + c(i) |
| 80 |
!$omp scan inclusive (a) |
| 81 |
d(i) = a |
| 82 |
end do |
| 83 |
|
| 84 |
!$omp do reduction (inscan, +: a) schedule(static, 2) ! { dg-error "SCHEDULE clause specified together with 'inscan' REDUCTION clause" } |
| 85 |
do i = 1, 64 |
| 86 |
a = a + c(i) |
| 87 |
!$omp scan inclusive (a) |
| 88 |
d(i) = a |
| 89 |
end do |
| 90 |
|
| 91 |
!$omp do reduction (inscan, +: a) schedule(nonmonotonic: dynamic, 2) ! { dg-error "SCHEDULE clause specified together with 'inscan' REDUCTION clause" } |
| 92 |
do i = 1, 64 |
| 93 |
a = a + c(i) |
| 94 |
!$omp scan inclusive (a) |
| 95 |
d(i) = a |
| 96 |
end do |
| 97 |
end |
| 98 |
|
| 99 |
subroutine f3 (c, d) |
| 100 |
use m |
| 101 |
implicit none |
| 102 |
integer i, c(64), d(64) |
| 103 |
!$omp teams reduction (inscan, +: a) |
| 104 |
! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" "" { target *-*-* } .-1 } |
| 105 |
! ... |
| 106 |
!$omp end teams |
| 107 |
|
| 108 |
!$omp scope reduction (inscan, +: a) |
| 109 |
! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" "" { target *-*-* } .-1 } |
| 110 |
! ... |
| 111 |
!$omp end scope |
| 112 |
|
| 113 |
!$omp target parallel do reduction (inscan, +: a) map (c, d) |
| 114 |
! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" "" { target *-*-* } .-1 } |
| 115 |
do i = 1, 64 |
| 116 |
d(i) = a |
| 117 |
!$omp scan exclusive (a) |
| 118 |
a = a + c(i) |
| 119 |
end do |
| 120 |
!$omp teams |
| 121 |
!$omp distribute parallel do reduction (inscan, +: a) |
| 122 |
! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" "" { target *-*-* } .-1 } |
| 123 |
do i = 1, 64 |
| 124 |
d(i) = a |
| 125 |
!$omp scan exclusive (a) |
| 126 |
a = a + c(i) |
| 127 |
end do |
| 128 |
!$omp end teams |
| 129 |
|
| 130 |
!$omp distribute parallel do simd reduction (inscan, +: a) |
| 131 |
! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" "" { target *-*-* } .-1 } |
| 132 |
do i = 1, 64 |
| 133 |
d(i) = a |
| 134 |
!$omp scan exclusive (a) |
| 135 |
a = a + c(i) |
| 136 |
end do |
| 137 |
end |
| 138 |
|
| 139 |
subroutine f4 (c, d) |
| 140 |
use m |
| 141 |
implicit none |
| 142 |
integer i, c(64), d(64) |
| 143 |
!$omp taskloop reduction (inscan, +: a) |
| 144 |
! { dg-error "'inscan' REDUCTION clause on construct other than DO, SIMD, DO SIMD, PARALLEL DO, PARALLEL DO SIMD" "" { target *-*-* } .-1 } |
| 145 |
do i = 1, 64 |
| 146 |
d(i) = a |
| 147 |
!$omp scan exclusive (a) |
| 148 |
a = a + c(i) |
| 149 |
end do |
| 150 |
end |
| 151 |
|
| 152 |
subroutine f7 |
| 153 |
use m |
| 154 |
implicit none |
| 155 |
integer i |
| 156 |
!$omp simd reduction (inscan, +: a) |
| 157 |
do i = 1, 64 |
| 158 |
if (i == 23) then ! { dg-error "invalid exit from OpenMP structured block" "" { target c++ } .+1 } |
| 159 |
cycle ! { dg-error "invalid branch to/from OpenMP structured block" "" { target c } } |
| 160 |
elseif (i == 27) then |
| 161 |
goto 123 ! Diagnostic by ME, see scan-7.f90 |
| 162 |
! { dg-warning "is not in the same block as the GOTO statement" "" { target *-*-* } .-1 } |
| 163 |
endif |
| 164 |
!$omp scan exclusive (a) |
| 165 |
block |
| 166 |
123 a = 0 ! { dg-error "jump to label 'l1'" "" { target c++ } } |
| 167 |
! { dg-warning "is not in the same block as the GOTO statement" "" { target *-*-* } .-1 } |
| 168 |
if (i == 33) then ! { dg-error "invalid exit from OpenMP structured block" "" { target c++ } .+1 } |
| 169 |
cycle ! { dg-error "invalid branch to/from OpenMP structured block" "" { target c } } |
| 170 |
end if |
| 171 |
end block |
| 172 |
end do |
| 173 |
end |
| 174 |
|
| 175 |
subroutine f8 (c, d, e, f) |
| 176 |
use m |
| 177 |
implicit none |
| 178 |
integer i, c(64), d(64), e(64), f(64) |
| 179 |
!$omp do reduction (inscan, +: a, b) ! { dg-error "With INSCAN at .1., expected loop body with ..OMP SCAN between two structured block sequences" } |
| 180 |
do i = 1, 64 |
| 181 |
block |
| 182 |
a = a + c(i) |
| 183 |
b = b + d(i) |
| 184 |
end block |
| 185 |
!$omp scan inclusive (a) inclusive (b) ! { dg-error "Unexpected junk after ..OMP SCAN" } |
| 186 |
block |
| 187 |
e(i) = a |
| 188 |
f(i) = b |
| 189 |
end block |
| 190 |
end do |
| 191 |
|
| 192 |
!$omp do reduction (inscan, +: a, b) ! { dg-error "With INSCAN at .1., expected loop body with ..OMP SCAN between two structured block sequences" } |
| 193 |
do i = 1, 64 |
| 194 |
block |
| 195 |
a = a + c(i) |
| 196 |
b = b + d(i) |
| 197 |
end block |
| 198 |
!$omp scan ! { dg-error "Expected INCLUSIVE or EXCLUSIVE clause" } |
| 199 |
block |
| 200 |
e(i) = a |
| 201 |
f(i) = b |
| 202 |
end block |
| 203 |
end do |
| 204 |
end |
| 205 |
|
| 206 |
subroutine f9 |
| 207 |
use m |
| 208 |
implicit none |
| 209 |
integer i |
| 210 |
!$omp simd reduction (inscan, +: a) |
| 211 |
do i = 1, 64 |
| 212 |
if (i == 23) & |
| 213 |
exit ! { dg-error "EXIT statement at .1. terminating ..OMP DO loop" } */ |
| 214 |
!$omp scan exclusive (a) ! { dg-warning "!.OMP SCAN at .1. with zero executable statements in preceding structured block sequence" } |
| 215 |
a = a + 1 |
| 216 |
end do |
| 217 |
end |