1 /* PR middle-end/45423 */ 2 /* { dg-do compile } */ 3 /* { dg-options "-fopenmp -fdump-tree-gimple -g0" } */ 4 /* atomicvar should never be referenced in between the barrier and 5 following #pragma omp atomic_load. */ 6 /* { dg-final { scan-tree-dump-not "barrier\[^#\]*atomicvar" "gimple" } } */ 7 /* { dg-final { cleanup-tree-dump "gimple" } } */ 8 9 #ifdef __cplusplus 10 bool atomicvar, c; 11 #else 12 _Bool atomicvar, c; 13 #endif 14 int i, atomicvar2, c2; 15 16 int foo(void)17foo (void) 18 { 19 #pragma omp barrier 20 #pragma omp atomic 21 atomicvar |= -1; 22 #pragma omp barrier 23 #pragma omp atomic 24 atomicvar |= 0; 25 #pragma omp barrier 26 #pragma omp atomic 27 atomicvar |= 1; 28 #pragma omp barrier 29 #pragma omp atomic 30 atomicvar |= 2; 31 #pragma omp barrier 32 #pragma omp atomic 33 atomicvar |= c; 34 #pragma omp barrier 35 #pragma omp atomic 36 atomicvar ^= -1; 37 #pragma omp barrier 38 #pragma omp atomic 39 atomicvar ^= 0; 40 #pragma omp barrier 41 #pragma omp atomic 42 atomicvar ^= 1; 43 #pragma omp barrier 44 #pragma omp atomic 45 atomicvar ^= 2; 46 #pragma omp barrier 47 #pragma omp atomic 48 atomicvar ^= c; 49 #pragma omp barrier 50 #pragma omp atomic 51 atomicvar &= -1; 52 #pragma omp barrier 53 #pragma omp atomic 54 atomicvar &= 0; 55 #pragma omp barrier 56 #pragma omp atomic 57 atomicvar &= 1; 58 #pragma omp barrier 59 #pragma omp atomic 60 atomicvar &= 2; 61 #pragma omp barrier 62 #pragma omp atomic 63 atomicvar &= c; 64 #pragma omp barrier 65 #pragma omp atomic 66 atomicvar += -1; 67 #pragma omp barrier 68 #pragma omp atomic 69 atomicvar += 0; 70 #pragma omp barrier 71 #pragma omp atomic 72 atomicvar += 1; 73 #pragma omp barrier 74 #pragma omp atomic 75 atomicvar += 2; 76 #pragma omp barrier 77 #pragma omp atomic 78 atomicvar += c; 79 #pragma omp barrier 80 #pragma omp atomic 81 atomicvar -= -1; 82 #pragma omp barrier 83 #pragma omp atomic 84 atomicvar -= 0; 85 #pragma omp barrier 86 #pragma omp atomic 87 atomicvar -= 1; 88 #pragma omp barrier 89 #pragma omp atomic 90 atomicvar -= 2; 91 #pragma omp barrier 92 #pragma omp atomic 93 atomicvar -= c; 94 #pragma omp barrier 95 #pragma omp atomic 96 atomicvar *= -1; 97 #pragma omp barrier 98 #pragma omp atomic 99 atomicvar *= 0; 100 #pragma omp barrier 101 #pragma omp atomic 102 atomicvar *= 1; 103 #pragma omp barrier 104 #pragma omp atomic 105 atomicvar *= 2; 106 #pragma omp barrier 107 #pragma omp atomic 108 atomicvar *= c; 109 #pragma omp barrier 110 #pragma omp atomic 111 atomicvar /= -1; 112 #pragma omp barrier 113 #pragma omp atomic 114 atomicvar /= 1; 115 #pragma omp barrier 116 #pragma omp atomic 117 atomicvar /= 2; 118 #pragma omp barrier 119 #pragma omp atomic 120 atomicvar /= c; 121 #pragma omp barrier 122 #pragma omp atomic 123 atomicvar <<= 0; 124 #pragma omp barrier 125 #pragma omp atomic 126 atomicvar <<= 1; 127 #pragma omp barrier 128 #pragma omp atomic 129 atomicvar <<= 2; 130 #pragma omp barrier 131 #pragma omp atomic 132 atomicvar <<= i; 133 #pragma omp barrier 134 #pragma omp atomic 135 atomicvar >>= 0; 136 #pragma omp barrier 137 #pragma omp atomic 138 atomicvar >>= 1; 139 #pragma omp barrier 140 #pragma omp atomic 141 atomicvar >>= 2; 142 #pragma omp barrier 143 #pragma omp atomic 144 atomicvar >>= i; 145 #pragma omp barrier 146 #pragma omp atomic 147 atomicvar++; 148 #pragma omp barrier 149 #pragma omp atomic 150 ++atomicvar; 151 #pragma omp barrier 152 #ifndef __cplusplus 153 #pragma omp atomic 154 atomicvar--; 155 #pragma omp barrier 156 #pragma omp atomic 157 --atomicvar; 158 #pragma omp barrier 159 #endif 160 return 0; 161 } 162 163 int bar(void)164bar (void) 165 { 166 #pragma omp barrier 167 #pragma omp atomic 168 atomicvar2 |= -1; 169 #pragma omp barrier 170 #pragma omp atomic 171 atomicvar2 |= 0; 172 #pragma omp barrier 173 #pragma omp atomic 174 atomicvar2 |= 1; 175 #pragma omp barrier 176 #pragma omp atomic 177 atomicvar2 |= 2; 178 #pragma omp barrier 179 #pragma omp atomic 180 atomicvar2 |= c2; 181 #pragma omp barrier 182 #pragma omp atomic 183 atomicvar2 ^= -1; 184 #pragma omp barrier 185 #pragma omp atomic 186 atomicvar2 ^= 0; 187 #pragma omp barrier 188 #pragma omp atomic 189 atomicvar2 ^= 1; 190 #pragma omp barrier 191 #pragma omp atomic 192 atomicvar2 ^= 2; 193 #pragma omp barrier 194 #pragma omp atomic 195 atomicvar2 ^= c2; 196 #pragma omp barrier 197 #pragma omp atomic 198 atomicvar2 &= -1; 199 #pragma omp barrier 200 #pragma omp atomic 201 atomicvar2 &= 0; 202 #pragma omp barrier 203 #pragma omp atomic 204 atomicvar2 &= 1; 205 #pragma omp barrier 206 #pragma omp atomic 207 atomicvar2 &= 2; 208 #pragma omp barrier 209 #pragma omp atomic 210 atomicvar2 &= c2; 211 #pragma omp barrier 212 #pragma omp atomic 213 atomicvar2 += -1; 214 #pragma omp barrier 215 #pragma omp atomic 216 atomicvar2 += 0; 217 #pragma omp barrier 218 #pragma omp atomic 219 atomicvar2 += 1; 220 #pragma omp barrier 221 #pragma omp atomic 222 atomicvar2 += 2; 223 #pragma omp barrier 224 #pragma omp atomic 225 atomicvar2 += c2; 226 #pragma omp barrier 227 #pragma omp atomic 228 atomicvar2 -= -1; 229 #pragma omp barrier 230 #pragma omp atomic 231 atomicvar2 -= 0; 232 #pragma omp barrier 233 #pragma omp atomic 234 atomicvar2 -= 1; 235 #pragma omp barrier 236 #pragma omp atomic 237 atomicvar2 -= 2; 238 #pragma omp barrier 239 #pragma omp atomic 240 atomicvar2 -= c2; 241 #pragma omp barrier 242 #pragma omp atomic 243 atomicvar2 *= -1; 244 #pragma omp barrier 245 #pragma omp atomic 246 atomicvar2 *= 0; 247 #pragma omp barrier 248 #pragma omp atomic 249 atomicvar2 *= 1; 250 #pragma omp barrier 251 #pragma omp atomic 252 atomicvar2 *= 2; 253 #pragma omp barrier 254 #pragma omp atomic 255 atomicvar2 *= c2; 256 #pragma omp barrier 257 #pragma omp atomic 258 atomicvar2 /= -1; 259 #pragma omp barrier 260 #pragma omp atomic 261 atomicvar2 /= 1; 262 #pragma omp barrier 263 #pragma omp atomic 264 atomicvar2 /= 2; 265 #pragma omp barrier 266 #pragma omp atomic 267 atomicvar2 /= c2; 268 #pragma omp barrier 269 #pragma omp atomic 270 atomicvar2 <<= 0; 271 #pragma omp barrier 272 #pragma omp atomic 273 atomicvar2 <<= 1; 274 #pragma omp barrier 275 #pragma omp atomic 276 atomicvar2 <<= 2; 277 #pragma omp barrier 278 #pragma omp atomic 279 atomicvar2 <<= i; 280 #pragma omp barrier 281 #pragma omp atomic 282 atomicvar2 >>= 0; 283 #pragma omp barrier 284 #pragma omp atomic 285 atomicvar2 >>= 1; 286 #pragma omp barrier 287 #pragma omp atomic 288 atomicvar2 >>= 2; 289 #pragma omp barrier 290 #pragma omp atomic 291 atomicvar2 >>= i; 292 #pragma omp barrier 293 #pragma omp atomic 294 atomicvar2++; 295 #pragma omp barrier 296 #pragma omp atomic 297 ++atomicvar2; 298 #pragma omp barrier 299 #pragma omp atomic 300 atomicvar2--; 301 #pragma omp barrier 302 #pragma omp atomic 303 --atomicvar2; 304 #pragma omp barrier 305 return 0; 306 } 307