1 // RUN: %clang_cc1 -fsyntax-only -fopenmp=libiomp5 -verify %s 2 3 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp for simd'}} 4 #pragma omp for simd 5 6 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp for simd'}} 7 #pragma omp for simd foo 8 9 void test_no_clause() { 10 int i; 11 #pragma omp for simd 12 for (i = 0; i < 16; ++i) 13 ; 14 15 // expected-error@+2 {{statement after '#pragma omp for simd' must be a for loop}} 16 #pragma omp for simd 17 ++i; 18 } 19 20 void test_branch_protected_scope() { 21 int i = 0; 22 L1: 23 ++i; 24 25 int x[24]; 26 27 #pragma omp parallel 28 #pragma omp for simd 29 for (i = 0; i < 16; ++i) { 30 if (i == 5) 31 goto L1; // expected-error {{use of undeclared label 'L1'}} 32 else if (i == 6) 33 return; // expected-error {{cannot return from OpenMP region}} 34 else if (i == 7) 35 goto L2; 36 else if (i == 8) { 37 L2: 38 x[i]++; 39 } 40 } 41 42 if (x[0] == 0) 43 goto L2; // expected-error {{use of undeclared label 'L2'}} 44 else if (x[1] == 1) 45 goto L1; 46 } 47 48 void test_invalid_clause() { 49 int i; 50 #pragma omp parallel 51 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}} 52 #pragma omp for simd foo bar 53 for (i = 0; i < 16; ++i) 54 ; 55 } 56 57 void test_non_identifiers() { 58 int i, x; 59 60 #pragma omp parallel 61 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}} 62 #pragma omp for simd; 63 for (i = 0; i < 16; ++i) 64 ; 65 #pragma omp parallel 66 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}} 67 #pragma omp for simd linear(x); 68 for (i = 0; i < 16; ++i) 69 ; 70 71 #pragma omp parallel 72 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}} 73 #pragma omp for simd private(x); 74 for (i = 0; i < 16; ++i) 75 ; 76 77 #pragma omp parallel 78 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}} 79 #pragma omp for simd, private(x); 80 for (i = 0; i < 16; ++i) 81 ; 82 } 83 84 extern int foo(); 85 void test_safelen() { 86 int i; 87 // expected-error@+1 {{expected '('}} 88 #pragma omp for simd safelen 89 for (i = 0; i < 16; ++i) 90 ; 91 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 92 #pragma omp for simd safelen( 93 for (i = 0; i < 16; ++i) 94 ; 95 // expected-error@+1 {{expected expression}} 96 #pragma omp for simd safelen() 97 for (i = 0; i < 16; ++i) 98 ; 99 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 100 #pragma omp for simd safelen(, 101 for (i = 0; i < 16; ++i) 102 ; 103 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 104 #pragma omp for simd safelen(, ) 105 for (i = 0; i < 16; ++i) 106 ; 107 // expected-warning@+2 {{extra tokens at the end of '#pragma omp for simd' are ignored}} 108 // expected-error@+1 {{expected '('}} 109 #pragma omp for simd safelen 4) 110 for (i = 0; i < 16; ++i) 111 ; 112 // expected-error@+2 {{expected ')'}} 113 // expected-note@+1 {{to match this '('}} 114 #pragma omp for simd safelen(4 115 for (i = 0; i < 16; ++i) 116 ; 117 // expected-error@+2 {{expected ')'}} 118 // expected-note@+1 {{to match this '('}} 119 #pragma omp for simd safelen(4, 120 for (i = 0; i < 16; ++i) 121 ; 122 // expected-error@+2 {{expected ')'}} 123 // expected-note@+1 {{to match this '('}} 124 #pragma omp for simd safelen(4, ) 125 for (i = 0; i < 16; ++i) 126 ; 127 #pragma omp for simd safelen(4) 128 for (i = 0; i < 16; ++i) 129 ; 130 // expected-error@+2 {{expected ')'}} 131 // expected-note@+1 {{to match this '('}} 132 #pragma omp for simd safelen(4 4) 133 for (i = 0; i < 16; ++i) 134 ; 135 // expected-error@+2 {{expected ')'}} 136 // expected-note@+1 {{to match this '('}} 137 #pragma omp for simd safelen(4, , 4) 138 for (i = 0; i < 16; ++i) 139 ; 140 #pragma omp for simd safelen(4) 141 for (i = 0; i < 16; ++i) 142 ; 143 // expected-error@+2 {{expected ')'}} 144 // expected-note@+1 {{to match this '('}} 145 #pragma omp for simd safelen(4, 8) 146 for (i = 0; i < 16; ++i) 147 ; 148 // expected-error@+1 {{expression is not an integer constant expression}} 149 #pragma omp for simd safelen(2.5) 150 for (i = 0; i < 16; ++i) 151 ; 152 // expected-error@+1 {{expression is not an integer constant expression}} 153 #pragma omp for simd safelen(foo()) 154 for (i = 0; i < 16; ++i) 155 ; 156 // expected-error@+1 {{argument to 'safelen' clause must be a positive integer value}} 157 #pragma omp for simd safelen(-5) 158 for (i = 0; i < 16; ++i) 159 ; 160 // expected-error@+1 {{argument to 'safelen' clause must be a positive integer value}} 161 #pragma omp for simd safelen(0) 162 for (i = 0; i < 16; ++i) 163 ; 164 // expected-error@+1 {{argument to 'safelen' clause must be a positive integer value}} 165 #pragma omp for simd safelen(5 - 5) 166 for (i = 0; i < 16; ++i) 167 ; 168 } 169 170 void test_collapse() { 171 int i; 172 #pragma omp parallel 173 // expected-error@+1 {{expected '('}} 174 #pragma omp for simd collapse 175 for (i = 0; i < 16; ++i) 176 ; 177 #pragma omp parallel 178 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 179 #pragma omp for simd collapse( 180 for (i = 0; i < 16; ++i) 181 ; 182 #pragma omp parallel 183 // expected-error@+1 {{expected expression}} 184 #pragma omp for simd collapse() 185 for (i = 0; i < 16; ++i) 186 ; 187 #pragma omp parallel 188 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 189 #pragma omp for simd collapse(, 190 for (i = 0; i < 16; ++i) 191 ; 192 #pragma omp parallel 193 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 194 #pragma omp for simd collapse(, ) 195 for (i = 0; i < 16; ++i) 196 ; 197 #pragma omp parallel 198 // expected-warning@+2 {{extra tokens at the end of '#pragma omp for simd' are ignored}} 199 // expected-error@+1 {{expected '('}} 200 #pragma omp for simd collapse 4) 201 for (i = 0; i < 16; ++i) 202 ; 203 #pragma omp parallel 204 // expected-error@+2 {{expected ')'}} 205 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} 206 #pragma omp for simd collapse(4 207 for (i = 0; i < 16; ++i) 208 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}} 209 #pragma omp parallel 210 // expected-error@+2 {{expected ')'}} 211 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} 212 #pragma omp for simd collapse(4, 213 for (i = 0; i < 16; ++i) 214 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}} 215 #pragma omp parallel 216 // expected-error@+2 {{expected ')'}} 217 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} 218 #pragma omp for simd collapse(4, ) 219 for (i = 0; i < 16; ++i) 220 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}} 221 #pragma omp parallel 222 // expected-note@+1 {{as specified in 'collapse' clause}} 223 #pragma omp for simd collapse(4) 224 for (i = 0; i < 16; ++i) 225 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}} 226 #pragma omp parallel 227 // expected-error@+2 {{expected ')'}} 228 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} 229 #pragma omp for simd collapse(4 4) 230 for (i = 0; i < 16; ++i) 231 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}} 232 #pragma omp parallel 233 // expected-error@+2 {{expected ')'}} 234 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} 235 #pragma omp for simd collapse(4, , 4) 236 for (i = 0; i < 16; ++i) 237 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}} 238 #pragma omp parallel 239 #pragma omp for simd collapse(4) 240 for (int i1 = 0; i1 < 16; ++i1) 241 for (int i2 = 0; i2 < 16; ++i2) 242 for (int i3 = 0; i3 < 16; ++i3) 243 for (int i4 = 0; i4 < 16; ++i4) 244 foo(); 245 #pragma omp parallel 246 // expected-error@+2 {{expected ')'}} 247 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} 248 #pragma omp for simd collapse(4, 8) 249 for (i = 0; i < 16; ++i) 250 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}} 251 #pragma omp parallel 252 // expected-error@+1 {{expression is not an integer constant expression}} 253 #pragma omp for simd collapse(2.5) 254 for (i = 0; i < 16; ++i) 255 ; 256 #pragma omp parallel 257 // expected-error@+1 {{expression is not an integer constant expression}} 258 #pragma omp for simd collapse(foo()) 259 for (i = 0; i < 16; ++i) 260 ; 261 #pragma omp parallel 262 // expected-error@+1 {{argument to 'collapse' clause must be a positive integer value}} 263 #pragma omp for simd collapse(-5) 264 for (i = 0; i < 16; ++i) 265 ; 266 #pragma omp parallel 267 // expected-error@+1 {{argument to 'collapse' clause must be a positive integer value}} 268 #pragma omp for simd collapse(0) 269 for (i = 0; i < 16; ++i) 270 ; 271 #pragma omp parallel 272 // expected-error@+1 {{argument to 'collapse' clause must be a positive integer value}} 273 #pragma omp for simd collapse(5 - 5) 274 for (i = 0; i < 16; ++i) 275 ; 276 #pragma omp parallel 277 #pragma omp for simd collapse(2) 278 for (i = 0; i < 16; ++i) 279 // expected-note@+1 {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for simd' directive into a parallel or another task region?}} 280 for (int j = 0; j < 16; ++j) 281 // expected-error@+2 {{private variable cannot be reduction}} 282 // expected-error@+1 {{OpenMP constructs may not be nested inside a simd region}} 283 #pragma omp for simd reduction(+ : i, j) 284 for (int k = 0; k < 16; ++k) 285 i += j; 286 } 287 288 void test_linear() { 289 int i; 290 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 291 #pragma omp for simd linear( 292 for (i = 0; i < 16; ++i) 293 ; 294 // expected-error@+2 {{expected expression}} 295 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 296 #pragma omp for simd linear(, 297 for (i = 0; i < 16; ++i) 298 ; 299 // expected-error@+2 {{expected expression}} 300 // expected-error@+1 {{expected expression}} 301 #pragma omp for simd linear(, ) 302 for (i = 0; i < 16; ++i) 303 ; 304 // expected-error@+1 {{expected expression}} 305 #pragma omp for simd linear() 306 for (i = 0; i < 16; ++i) 307 ; 308 // expected-error@+1 {{expected expression}} 309 #pragma omp for simd linear(int) 310 for (i = 0; i < 16; ++i) 311 ; 312 // expected-error@+1 {{expected variable name}} 313 #pragma omp for simd linear(0) 314 for (i = 0; i < 16; ++i) 315 ; 316 // expected-error@+1 {{use of undeclared identifier 'x'}} 317 #pragma omp for simd linear(x) 318 for (i = 0; i < 16; ++i) 319 ; 320 // expected-error@+2 {{use of undeclared identifier 'x'}} 321 // expected-error@+1 {{use of undeclared identifier 'y'}} 322 #pragma omp for simd linear(x, y) 323 for (i = 0; i < 16; ++i) 324 ; 325 // expected-error@+3 {{use of undeclared identifier 'x'}} 326 // expected-error@+2 {{use of undeclared identifier 'y'}} 327 // expected-error@+1 {{use of undeclared identifier 'z'}} 328 #pragma omp for simd linear(x, y, z) 329 for (i = 0; i < 16; ++i) 330 ; 331 332 int x, y; 333 // expected-error@+1 {{expected expression}} 334 #pragma omp for simd linear(x :) 335 for (i = 0; i < 16; ++i) 336 ; 337 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 338 #pragma omp for simd linear(x :, ) 339 for (i = 0; i < 16; ++i) 340 ; 341 #pragma omp for simd linear(x : 1) 342 for (i = 0; i < 16; ++i) 343 ; 344 #pragma omp for simd linear(x : 2 * 2) 345 for (i = 0; i < 16; ++i) 346 ; 347 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 348 #pragma omp for simd linear(x : 1, y) 349 for (i = 0; i < 16; ++i) 350 ; 351 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 352 #pragma omp for simd linear(x : 1, y, z : 1) 353 for (i = 0; i < 16; ++i) 354 ; 355 356 // expected-note@+2 {{defined as linear}} 357 // expected-error@+1 {{linear variable cannot be linear}} 358 #pragma omp for simd linear(x) linear(x) 359 for (i = 0; i < 16; ++i) 360 ; 361 362 // expected-note@+2 {{defined as private}} 363 // expected-error@+1 {{private variable cannot be linear}} 364 #pragma omp for simd private(x) linear(x) 365 for (i = 0; i < 16; ++i) 366 ; 367 368 // expected-note@+2 {{defined as linear}} 369 // expected-error@+1 {{linear variable cannot be private}} 370 #pragma omp for simd linear(x) private(x) 371 for (i = 0; i < 16; ++i) 372 ; 373 374 // expected-warning@+1 {{zero linear step (x and other variables in clause should probably be const)}} 375 #pragma omp for simd linear(x, y : 0) 376 for (i = 0; i < 16; ++i) 377 ; 378 379 // expected-note@+2 {{defined as linear}} 380 // expected-error@+1 {{linear variable cannot be lastprivate}} 381 #pragma omp for simd linear(x) lastprivate(x) 382 for (i = 0; i < 16; ++i) 383 ; 384 385 #pragma omp parallel 386 // expected-note@+2 {{defined as lastprivate}} 387 // expected-error@+1 {{lastprivate variable cannot be linear}} 388 #pragma omp for simd lastprivate(x) linear(x) 389 for (i = 0; i < 16; ++i) 390 ; 391 } 392 393 void test_aligned() { 394 int i; 395 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 396 #pragma omp for simd aligned( 397 for (i = 0; i < 16; ++i) 398 ; 399 // expected-error@+2 {{expected expression}} 400 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 401 #pragma omp for simd aligned(, 402 for (i = 0; i < 16; ++i) 403 ; 404 // expected-error@+2 {{expected expression}} 405 // expected-error@+1 {{expected expression}} 406 #pragma omp for simd aligned(, ) 407 for (i = 0; i < 16; ++i) 408 ; 409 // expected-error@+1 {{expected expression}} 410 #pragma omp for simd aligned() 411 for (i = 0; i < 16; ++i) 412 ; 413 // expected-error@+1 {{expected expression}} 414 #pragma omp for simd aligned(int) 415 for (i = 0; i < 16; ++i) 416 ; 417 // expected-error@+1 {{expected variable name}} 418 #pragma omp for simd aligned(0) 419 for (i = 0; i < 16; ++i) 420 ; 421 // expected-error@+1 {{use of undeclared identifier 'x'}} 422 #pragma omp for simd aligned(x) 423 for (i = 0; i < 16; ++i) 424 ; 425 // expected-error@+2 {{use of undeclared identifier 'x'}} 426 // expected-error@+1 {{use of undeclared identifier 'y'}} 427 #pragma omp for simd aligned(x, y) 428 for (i = 0; i < 16; ++i) 429 ; 430 // expected-error@+3 {{use of undeclared identifier 'x'}} 431 // expected-error@+2 {{use of undeclared identifier 'y'}} 432 // expected-error@+1 {{use of undeclared identifier 'z'}} 433 #pragma omp for simd aligned(x, y, z) 434 for (i = 0; i < 16; ++i) 435 ; 436 437 int *x, y, z[25]; // expected-note 4 {{'y' defined here}} 438 #pragma omp for simd aligned(x) 439 for (i = 0; i < 16; ++i) 440 ; 441 #pragma omp for simd aligned(z) 442 for (i = 0; i < 16; ++i) 443 ; 444 // expected-error@+1 {{expected expression}} 445 #pragma omp for simd aligned(x :) 446 for (i = 0; i < 16; ++i) 447 ; 448 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 449 #pragma omp for simd aligned(x :, ) 450 for (i = 0; i < 16; ++i) 451 ; 452 #pragma omp for simd aligned(x : 1) 453 for (i = 0; i < 16; ++i) 454 ; 455 #pragma omp for simd aligned(x : 2 * 2) 456 for (i = 0; i < 16; ++i) 457 ; 458 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 459 #pragma omp for simd aligned(x : 1, y) 460 for (i = 0; i < 16; ++i) 461 ; 462 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 463 #pragma omp for simd aligned(x : 1, y, z : 1) 464 for (i = 0; i < 16; ++i) 465 ; 466 467 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}} 468 #pragma omp for simd aligned(x, y) 469 for (i = 0; i < 16; ++i) 470 ; 471 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}} 472 #pragma omp for simd aligned(x, y, z) 473 for (i = 0; i < 16; ++i) 474 ; 475 476 // expected-note@+2 {{defined as aligned}} 477 // expected-error@+1 {{a variable cannot appear in more than one aligned clause}} 478 #pragma omp for simd aligned(x) aligned(z, x) 479 for (i = 0; i < 16; ++i) 480 ; 481 482 // expected-note@+3 {{defined as aligned}} 483 // expected-error@+2 {{a variable cannot appear in more than one aligned clause}} 484 // expected-error@+1 2 {{argument of aligned clause should be array or pointer, not 'int'}} 485 #pragma omp for simd aligned(x, y, z) aligned(y, z) 486 for (i = 0; i < 16; ++i) 487 ; 488 } 489 490 491 void test_private() { 492 int i; 493 #pragma omp parallel 494 // expected-error@+2 {{expected expression}} 495 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 496 #pragma omp for simd private( 497 for (i = 0; i < 16; ++i) 498 ; 499 #pragma omp parallel 500 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} 501 // expected-error@+1 2 {{expected expression}} 502 #pragma omp for simd private(, 503 for (i = 0; i < 16; ++i) 504 ; 505 #pragma omp parallel 506 // expected-error@+1 2 {{expected expression}} 507 #pragma omp for simd private(, ) 508 for (i = 0; i < 16; ++i) 509 ; 510 #pragma omp parallel 511 // expected-error@+1 {{expected expression}} 512 #pragma omp for simd private() 513 for (i = 0; i < 16; ++i) 514 ; 515 #pragma omp parallel 516 // expected-error@+1 {{expected expression}} 517 #pragma omp for simd private(int) 518 for (i = 0; i < 16; ++i) 519 ; 520 #pragma omp parallel 521 // expected-error@+1 {{expected variable name}} 522 #pragma omp for simd private(0) 523 for (i = 0; i < 16; ++i) 524 ; 525 526 int x, y, z; 527 #pragma omp parallel 528 #pragma omp for simd private(x) 529 for (i = 0; i < 16; ++i) 530 ; 531 #pragma omp parallel 532 #pragma omp for simd private(x, y) 533 for (i = 0; i < 16; ++i) 534 ; 535 #pragma omp parallel 536 #pragma omp for simd private(x, y, z) 537 for (i = 0; i < 16; ++i) { 538 x = y * i + z; 539 } 540 } 541 542 void test_lastprivate() { 543 int i; 544 #pragma omp parallel 545 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} 546 // expected-error@+1 {{expected expression}} 547 #pragma omp for simd lastprivate( 548 for (i = 0; i < 16; ++i) 549 ; 550 551 #pragma omp parallel 552 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} 553 // expected-error@+1 2 {{expected expression}} 554 #pragma omp for simd lastprivate(, 555 for (i = 0; i < 16; ++i) 556 ; 557 #pragma omp parallel 558 // expected-error@+1 2 {{expected expression}} 559 #pragma omp for simd lastprivate(, ) 560 for (i = 0; i < 16; ++i) 561 ; 562 #pragma omp parallel 563 // expected-error@+1 {{expected expression}} 564 #pragma omp for simd lastprivate() 565 for (i = 0; i < 16; ++i) 566 ; 567 #pragma omp parallel 568 // expected-error@+1 {{expected expression}} 569 #pragma omp for simd lastprivate(int) 570 for (i = 0; i < 16; ++i) 571 ; 572 #pragma omp parallel 573 // expected-error@+1 {{expected variable name}} 574 #pragma omp for simd lastprivate(0) 575 for (i = 0; i < 16; ++i) 576 ; 577 578 int x, y, z; 579 #pragma omp parallel 580 #pragma omp for simd lastprivate(x) 581 for (i = 0; i < 16; ++i) 582 ; 583 #pragma omp parallel 584 #pragma omp for simd lastprivate(x, y) 585 for (i = 0; i < 16; ++i) 586 ; 587 #pragma omp parallel 588 #pragma omp for simd lastprivate(x, y, z) 589 for (i = 0; i < 16; ++i) 590 ; 591 } 592 593 void test_firstprivate() { 594 int i; 595 #pragma omp parallel 596 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} 597 // expected-error@+1 {{expected expression}} 598 #pragma omp for simd firstprivate( 599 for (i = 0; i < 16; ++i) 600 ; 601 602 #pragma omp parallel 603 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} 604 // expected-error@+1 2 {{expected expression}} 605 #pragma omp for simd firstprivate(, 606 for (i = 0; i < 16; ++i) 607 ; 608 #pragma omp parallel 609 // expected-error@+1 2 {{expected expression}} 610 #pragma omp for simd firstprivate(, ) 611 for (i = 0; i < 16; ++i) 612 ; 613 #pragma omp parallel 614 // expected-error@+1 {{expected expression}} 615 #pragma omp for simd firstprivate() 616 for (i = 0; i < 16; ++i) 617 ; 618 #pragma omp parallel 619 // expected-error@+1 {{expected expression}} 620 #pragma omp for simd firstprivate(int) 621 for (i = 0; i < 16; ++i) 622 ; 623 #pragma omp parallel 624 // expected-error@+1 {{expected variable name}} 625 #pragma omp for simd firstprivate(0) 626 for (i = 0; i < 16; ++i) 627 ; 628 629 int x, y, z; 630 #pragma omp parallel 631 #pragma omp for simd lastprivate(x) firstprivate(x) 632 for (i = 0; i < 16; ++i) 633 ; 634 #pragma omp parallel 635 #pragma omp for simd lastprivate(x, y) firstprivate(x, y) 636 for (i = 0; i < 16; ++i) 637 ; 638 #pragma omp parallel 639 #pragma omp for simd lastprivate(x, y, z) firstprivate(x, y, z) 640 for (i = 0; i < 16; ++i) 641 ; 642 } 643 644 void test_loop_messages() { 645 float a[100], b[100], c[100]; 646 #pragma omp parallel 647 // expected-error@+2 {{variable must be of integer or pointer type}} 648 #pragma omp for simd 649 for (float fi = 0; fi < 10.0; fi++) { 650 c[(int)fi] = a[(int)fi] + b[(int)fi]; 651 } 652 #pragma omp parallel 653 // expected-error@+2 {{variable must be of integer or pointer type}} 654 #pragma omp for simd 655 for (double fi = 0; fi < 10.0; fi++) { 656 c[(int)fi] = a[(int)fi] + b[(int)fi]; 657 } 658 } 659 660