| 1 |
int a, b; |
| 2 |
|
| 3 |
void |
| 4 |
f1 (void) |
| 5 |
{ |
| 6 |
#pragma omp scan inclusive (a) /* { dg-error "'#pragma omp scan' may only be used in a loop construct with 'inscan' 'reduction' clause" } */ |
| 7 |
#pragma omp scan exclusive (b) /* { dg-error "'#pragma omp scan' may only be used in a loop construct with 'inscan' 'reduction' clause" } */ |
| 8 |
} |
| 9 |
|
| 10 |
void |
| 11 |
f2 (int *c, int *d, int *e, int *f) |
| 12 |
{ |
| 13 |
int i, l = 1; |
| 14 |
#pragma omp for reduction (inscan, +: a) reduction (+: b) /* { dg-error "'inscan' and non-'inscan' 'reduction' clauses on the same construct" } */ |
| 15 |
for (i = 0; i < 64; i++) |
| 16 |
{ |
| 17 |
{ b++; a += c[i]; } |
| 18 |
#pragma omp scan inclusive (a) /* { dg-error "" } */ |
| 19 |
d[i] = a; |
| 20 |
} |
| 21 |
#pragma omp for reduction (+: a) reduction (inscan, +: b) /* { dg-error "'inscan' and non-'inscan' 'reduction' clauses on the same construct" } */ |
| 22 |
for (i = 0; i < 64; i++) |
| 23 |
{ |
| 24 |
{ a++; b += c[i]; } |
| 25 |
#pragma omp scan inclusive (b) /* { dg-error "" } */ |
| 26 |
d[i] = b; |
| 27 |
} |
| 28 |
#pragma omp for reduction (inscan, +: e[:2]) /* { dg-error "'inscan' 'reduction' clause with array section" } */ |
| 29 |
for (i = 0; i < 64; ++i) |
| 30 |
{ |
| 31 |
{ e[0] += c[i]; e[1] += c[i]; } |
| 32 |
#pragma omp scan inclusive (a, e[:2]) /* { dg-error "" } */ |
| 33 |
{ d[i] = e[0]; f[i] = e[1]; } |
| 34 |
} |
| 35 |
#pragma omp for reduction (inscan, +: a) ordered /* { dg-error "'ordered' clause specified together with 'inscan' 'reduction' clause" } */ |
| 36 |
for (i = 0; i < 64; i++) |
| 37 |
{ |
| 38 |
a += c[i]; |
| 39 |
#pragma omp scan inclusive (a) /* { dg-error "" } */ |
| 40 |
d[i] = a; |
| 41 |
} |
| 42 |
#pragma omp for reduction (inscan, +: a) ordered(1) /* { dg-error "'ordered' clause specified together with 'inscan' 'reduction' clause" } */ |
| 43 |
for (i = 0; i < 64; i++) |
| 44 |
{ |
| 45 |
a += c[i]; |
| 46 |
#pragma omp scan inclusive (a) /* { dg-error "" } */ |
| 47 |
d[i] = a; |
| 48 |
} |
| 49 |
#pragma omp for reduction (inscan, +: a) schedule(static) /* { dg-error "'schedule' clause specified together with 'inscan' 'reduction' clause" } */ |
| 50 |
for (i = 0; i < 64; i++) |
| 51 |
{ |
| 52 |
a += c[i]; |
| 53 |
#pragma omp scan inclusive (a) /* { dg-error "" } */ |
| 54 |
d[i] = a; |
| 55 |
} |
| 56 |
#pragma omp for reduction (inscan, +: a) schedule(static, 2) /* { dg-error "'schedule' clause specified together with 'inscan' 'reduction' clause" } */ |
| 57 |
for (i = 0; i < 64; i++) |
| 58 |
{ |
| 59 |
a += c[i]; |
| 60 |
#pragma omp scan inclusive (a) /* { dg-error "" } */ |
| 61 |
d[i] = a; |
| 62 |
} |
| 63 |
#pragma omp for reduction (inscan, +: a) schedule(nonmonotonic: dynamic, 2) /* { dg-error "'schedule' clause specified together with 'inscan' 'reduction' clause" } */ |
| 64 |
for (i = 0; i < 64; i++) |
| 65 |
{ |
| 66 |
a += c[i]; |
| 67 |
#pragma omp scan inclusive (a) /* { dg-error "" } */ |
| 68 |
d[i] = a; |
| 69 |
} |
| 70 |
#pragma omp for reduction (inscan, +: a) linear (l) /* { dg-error "'inscan' 'reduction' clause used together with 'linear' clause for a variable other than loop iterator" } */ |
| 71 |
for (i = 0; i < 64; i++) |
| 72 |
{ |
| 73 |
{ a += c[i]; ++l; } |
| 74 |
#pragma omp scan inclusive (a) |
| 75 |
d[i] = a; |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
void |
| 80 |
f3 (int *c, int *d) |
| 81 |
{ |
| 82 |
int i; |
| 83 |
#pragma omp teams reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on 'teams' construct" } */ |
| 84 |
; |
| 85 |
#pragma omp parallel reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on 'parallel' construct" } */ |
| 86 |
; |
| 87 |
#pragma omp sections reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on 'sections' construct" } */ |
| 88 |
{ |
| 89 |
#pragma omp section |
| 90 |
; |
| 91 |
} |
| 92 |
#pragma omp scope reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on 'scope' construct" } */ |
| 93 |
; |
| 94 |
#pragma omp target parallel for reduction (inscan, +: a) map (c[:64], d[:64]) /* { dg-error "'inscan' 'reduction' clause on construct other than 'for', 'simd', 'for simd', 'parallel for', 'parallel for simd'" } */ |
| 95 |
for (i = 0; i < 64; i++) |
| 96 |
{ |
| 97 |
d[i] = a; |
| 98 |
#pragma omp scan exclusive (a) /* { dg-error "" } */ |
| 99 |
a += c[i]; |
| 100 |
} |
| 101 |
#pragma omp teams |
| 102 |
{ |
| 103 |
#pragma omp distribute parallel for reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on construct other than 'for', 'simd', 'for simd', 'parallel for', 'parallel for simd'" } */ |
| 104 |
for (i = 0; i < 64; i++) |
| 105 |
{ |
| 106 |
d[i] = a; |
| 107 |
#pragma omp scan exclusive (a) /* { dg-error "" } */ |
| 108 |
a += c[i]; |
| 109 |
} |
| 110 |
#pragma omp distribute parallel for simd reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on construct other than 'for', 'simd', 'for simd', 'parallel for', 'parallel for simd'" } */ |
| 111 |
for (i = 0; i < 64; i++) |
| 112 |
{ |
| 113 |
d[i] = a; |
| 114 |
#pragma omp scan exclusive (a) /* { dg-error "" } */ |
| 115 |
a += c[i]; |
| 116 |
} |
| 117 |
} |
| 118 |
} |
| 119 |
|
| 120 |
void |
| 121 |
f4 (int *c, int *d) |
| 122 |
{ |
| 123 |
int i; |
| 124 |
#pragma omp taskloop reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on 'taskloop' construct" } */ |
| 125 |
for (i = 0; i < 64; i++) |
| 126 |
{ |
| 127 |
d[i] = a; |
| 128 |
#pragma omp scan exclusive (a) /* { dg-error "" } */ |
| 129 |
a += c[i]; |
| 130 |
} |
| 131 |
} |
| 132 |
|
| 133 |
void |
| 134 |
f5 (int *c, int *d) |
| 135 |
{ |
| 136 |
int i; |
| 137 |
#pragma omp simd reduction (inscan, +: a) |
| 138 |
for (i = 0; i < 64; i++) |
| 139 |
{ |
| 140 |
d[i] = a; |
| 141 |
#pragma omp scan exclusive (a, b) /* { dg-error "'b' specified in 'exclusive' clause but not in 'inscan' 'reduction' clause on the containing construct" } */ |
| 142 |
a += c[i]; |
| 143 |
} |
| 144 |
} |
| 145 |
|
| 146 |
void |
| 147 |
f6 (int *c, int *d) |
| 148 |
{ |
| 149 |
int i; |
| 150 |
#pragma omp simd reduction (inscan, +: a, b) /* { dg-error "'b' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */ |
| 151 |
for (i = 0; i < 64; i++) |
| 152 |
{ |
| 153 |
d[i] = a; |
| 154 |
#pragma omp scan exclusive (a) |
| 155 |
a += c[i]; |
| 156 |
} |
| 157 |
} |
| 158 |
|
| 159 |
void |
| 160 |
f7 (void) |
| 161 |
{ |
| 162 |
int i; |
| 163 |
#pragma omp simd reduction (inscan, +: a) |
| 164 |
for (i = 0; i < 64; i++) |
| 165 |
{ |
| 166 |
if (i == 23) /* { dg-error "invalid exit from OpenMP structured block" "" { target c++ } .+1 } */ |
| 167 |
continue; /* { dg-error "invalid branch to/from OpenMP structured block" "" { target c } } */ |
| 168 |
else if (i == 27) |
| 169 |
goto l1; /* { dg-error "invalid branch to/from OpenMP structured block" } */ |
| 170 |
#pragma omp scan exclusive (a) |
| 171 |
{ |
| 172 |
l1: a = 0; /* { dg-error "jump to label 'l1'" "" { target c++ } } */ |
| 173 |
if (i == 33) /* { dg-error "invalid exit from OpenMP structured block" "" { target c++ } .+1 } */ |
| 174 |
continue; /* { dg-error "invalid branch to/from OpenMP structured block" "" { target c } } */ |
| 175 |
} |
| 176 |
} |
| 177 |
} |
| 178 |
|
| 179 |
void |
| 180 |
f8 (int *c, int *d, int *e, int *f) |
| 181 |
{ |
| 182 |
int i; |
| 183 |
#pragma omp for reduction (inscan, +: a, b) /* { dg-error "'b' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */ |
| 184 |
for (i = 0; i < 64; i++) |
| 185 |
{ |
| 186 |
{ a += c[i]; b += d[i]; } |
| 187 |
#pragma omp scan inclusive (a) inclusive (b) /* { dg-error "expected end of line before 'inclusive'" } */ |
| 188 |
{ e[i] = a; f[i] = b; } |
| 189 |
} |
| 190 |
#pragma omp for reduction (inscan, +: a, b) /* { dg-error "'.' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */ |
| 191 |
for (i = 0; i < 64; i++) |
| 192 |
{ |
| 193 |
{ a += c[i]; b += d[i]; } |
| 194 |
#pragma omp scan /* { dg-error "expected 'inclusive' or 'exclusive' clause before end of line" } */ |
| 195 |
{ e[i] = a; f[i] = b; } |
| 196 |
} |
| 197 |
} |
| 198 |
|
| 199 |
void |
| 200 |
f9 (void) |
| 201 |
{ |
| 202 |
int i; |
| 203 |
#pragma omp simd reduction (inscan, +: a) |
| 204 |
for (i = 0; i < 64; i++) |
| 205 |
{ |
| 206 |
if (i == 23) /* { dg-error "invalid exit from OpenMP structured block" "" { target c++ } .+1 } */ |
| 207 |
break; /* { dg-error "break statement used with OpenMP for loop" "" { target c } } */ |
| 208 |
#pragma omp scan exclusive (a) |
| 209 |
a++; |
| 210 |
} |
| 211 |
} |