1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s 2 3 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp distribute parallel for simd'}} 4 #pragma omp distribute parallel for simd 5 6 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp distribute parallel for simd'}} 7 #pragma omp distribute parallel for simd foo 8 9 void test_no_clause() { 10 int i; 11 #pragma omp distribute parallel for simd 12 for (i = 0; i < 16; ++i) 13 ; 14 15 // expected-error@+2 {{statement after '#pragma omp distribute parallel for simd' must be a for loop}} 16 #pragma omp distribute parallel 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 target 28 #pragma omp teams 29 #pragma omp distribute parallel for simd 30 for (i = 0; i < 16; ++i) { 31 if (i == 5) 32 goto L1; // expected-error {{use of undeclared label 'L1'}} 33 else if (i == 6) 34 return; // expected-error {{cannot return from OpenMP region}} 35 else if (i == 7) 36 goto L2; 37 else if (i == 8) { 38 L2: 39 x[i]++; 40 } 41 } 42 43 if (x[0] == 0) 44 goto L2; // expected-error {{use of undeclared label 'L2'}} 45 else if (x[1] == 1) 46 goto L1; 47 } 48 49 void test_invalid_clause() { 50 int i; 51 #pragma omp target 52 #pragma omp teams 53 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} 54 #pragma omp distribute parallel for simd foo bar 55 for (i = 0; i < 16; ++i) 56 ; 57 } 58 59 void test_non_identifiers() { 60 int i, x; 61 62 #pragma omp target 63 #pragma omp teams 64 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} 65 #pragma omp distribute parallel for simd; 66 for (i = 0; i < 16; ++i) 67 ; 68 #pragma omp target 69 #pragma omp teams 70 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} 71 #pragma omp distribute parallel for simd linear(x); 72 for (i = 0; i < 16; ++i) 73 ; 74 75 #pragma omp target 76 #pragma omp teams 77 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} 78 #pragma omp distribute parallel for simd private(x); 79 for (i = 0; i < 16; ++i) 80 ; 81 82 #pragma omp target 83 #pragma omp teams 84 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} 85 #pragma omp distribute parallel for simd, private(x); 86 for (i = 0; i < 16; ++i) 87 ; 88 } 89 90 extern int foo(); 91 void test_safelen() { 92 int i; 93 #pragma omp target 94 #pragma omp teams 95 // expected-error@+1 {{expected '('}} 96 #pragma omp distribute parallel for simd safelen 97 for (i = 0; i < 16; ++i) 98 ; 99 #pragma omp target 100 #pragma omp teams 101 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 102 #pragma omp distribute parallel for simd safelen( 103 for (i = 0; i < 16; ++i) 104 ; 105 #pragma omp target 106 #pragma omp teams 107 // expected-error@+1 {{expected expression}} 108 #pragma omp distribute parallel for simd safelen() 109 for (i = 0; i < 16; ++i) 110 ; 111 #pragma omp target 112 #pragma omp teams 113 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 114 #pragma omp distribute parallel for simd safelen(, 115 for (i = 0; i < 16; ++i) 116 ; 117 #pragma omp target 118 #pragma omp teams 119 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 120 #pragma omp distribute parallel for simd safelen(, ) 121 for (i = 0; i < 16; ++i) 122 ; 123 #pragma omp target 124 #pragma omp teams 125 // expected-warning@+2 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} 126 // expected-error@+1 {{expected '('}} 127 #pragma omp distribute parallel for simd safelen 4) 128 for (i = 0; i < 16; ++i) 129 ; 130 #pragma omp target 131 #pragma omp teams 132 // expected-error@+2 {{expected ')'}} 133 // expected-note@+1 {{to match this '('}} 134 #pragma omp distribute parallel for simd safelen(4 135 for (i = 0; i < 16; ++i) 136 ; 137 #pragma omp target 138 #pragma omp teams 139 // expected-error@+2 {{expected ')'}} 140 // expected-note@+1 {{to match this '('}} 141 #pragma omp distribute parallel for simd safelen(4, 142 for (i = 0; i < 16; ++i) 143 ; 144 #pragma omp target 145 #pragma omp teams 146 // expected-error@+2 {{expected ')'}} 147 // expected-note@+1 {{to match this '('}} 148 #pragma omp distribute parallel for simd safelen(4, ) 149 for (i = 0; i < 16; ++i) 150 ; 151 #pragma omp target 152 #pragma omp teams 153 #pragma omp distribute parallel for simd safelen(4) 154 for (i = 0; i < 16; ++i) 155 ; 156 #pragma omp target 157 #pragma omp teams 158 // expected-error@+2 {{expected ')'}} 159 // expected-note@+1 {{to match this '('}} 160 #pragma omp distribute parallel for simd safelen(4 4) 161 for (i = 0; i < 16; ++i) 162 ; 163 #pragma omp target 164 #pragma omp teams 165 // expected-error@+2 {{expected ')'}} 166 // expected-note@+1 {{to match this '('}} 167 #pragma omp distribute parallel for simd safelen(4, , 4) 168 for (i = 0; i < 16; ++i) 169 ; 170 #pragma omp target 171 #pragma omp teams 172 #pragma omp distribute parallel for simd safelen(4) 173 for (i = 0; i < 16; ++i) 174 ; 175 #pragma omp target 176 #pragma omp teams 177 // expected-error@+2 {{expected ')'}} 178 // expected-note@+1 {{to match this '('}} 179 #pragma omp distribute parallel for simd safelen(4, 8) 180 for (i = 0; i < 16; ++i) 181 ; 182 #pragma omp target 183 #pragma omp teams 184 // expected-error@+1 {{expression is not an integer constant expression}} 185 #pragma omp distribute parallel for simd safelen(2.5) 186 for (i = 0; i < 16; ++i) 187 ; 188 #pragma omp target 189 #pragma omp teams 190 // expected-error@+1 {{expression is not an integer constant expression}} 191 #pragma omp distribute parallel for simd safelen(foo()) 192 for (i = 0; i < 16; ++i) 193 ; 194 #pragma omp target 195 #pragma omp teams 196 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}} 197 #pragma omp distribute parallel for simd safelen(-5) 198 for (i = 0; i < 16; ++i) 199 ; 200 #pragma omp target 201 #pragma omp teams 202 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}} 203 #pragma omp distribute parallel for simd safelen(0) 204 for (i = 0; i < 16; ++i) 205 ; 206 #pragma omp target 207 #pragma omp teams 208 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}} 209 #pragma omp distribute parallel for simd safelen(5 - 5) 210 for (i = 0; i < 16; ++i) 211 ; 212 } 213 214 void test_simdlen() { 215 int i; 216 #pragma omp target 217 #pragma omp teams 218 // expected-error@+1 {{expected '('}} 219 #pragma omp distribute parallel for simd simdlen 220 for (i = 0; i < 16; ++i) 221 ; 222 #pragma omp target 223 #pragma omp teams 224 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 225 #pragma omp distribute parallel for simd simdlen( 226 for (i = 0; i < 16; ++i) 227 ; 228 #pragma omp target 229 #pragma omp teams 230 // expected-error@+1 {{expected expression}} 231 #pragma omp distribute parallel for simd simdlen() 232 for (i = 0; i < 16; ++i) 233 ; 234 #pragma omp target 235 #pragma omp teams 236 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 237 #pragma omp distribute parallel for simd simdlen(, 238 for (i = 0; i < 16; ++i) 239 ; 240 #pragma omp target 241 #pragma omp teams 242 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 243 #pragma omp distribute parallel for simd simdlen(, ) 244 for (i = 0; i < 16; ++i) 245 ; 246 #pragma omp target 247 #pragma omp teams 248 // expected-warning@+2 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} 249 // expected-error@+1 {{expected '('}} 250 #pragma omp distribute parallel for simd simdlen 4) 251 for (i = 0; i < 16; ++i) 252 ; 253 #pragma omp target 254 #pragma omp teams 255 // expected-error@+2 {{expected ')'}} 256 // expected-note@+1 {{to match this '('}} 257 #pragma omp distribute parallel for simd simdlen(4 258 for (i = 0; i < 16; ++i) 259 ; 260 #pragma omp target 261 #pragma omp teams 262 // expected-error@+2 {{expected ')'}} 263 // expected-note@+1 {{to match this '('}} 264 #pragma omp distribute parallel for simd simdlen(4, 265 for (i = 0; i < 16; ++i) 266 ; 267 #pragma omp target 268 #pragma omp teams 269 // expected-error@+2 {{expected ')'}} 270 // expected-note@+1 {{to match this '('}} 271 #pragma omp distribute parallel for simd simdlen(4, ) 272 for (i = 0; i < 16; ++i) 273 ; 274 #pragma omp target 275 #pragma omp teams 276 #pragma omp distribute parallel for simd simdlen(4) 277 for (i = 0; i < 16; ++i) 278 ; 279 #pragma omp target 280 #pragma omp teams 281 // expected-error@+2 {{expected ')'}} 282 // expected-note@+1 {{to match this '('}} 283 #pragma omp distribute parallel for simd simdlen(4 4) 284 for (i = 0; i < 16; ++i) 285 ; 286 #pragma omp target 287 #pragma omp teams 288 // expected-error@+2 {{expected ')'}} 289 // expected-note@+1 {{to match this '('}} 290 #pragma omp distribute parallel for simd simdlen(4, , 4) 291 for (i = 0; i < 16; ++i) 292 ; 293 #pragma omp target 294 #pragma omp teams 295 #pragma omp distribute parallel for simd simdlen(4) 296 for (i = 0; i < 16; ++i) 297 ; 298 #pragma omp target 299 #pragma omp teams 300 // expected-error@+2 {{expected ')'}} 301 // expected-note@+1 {{to match this '('}} 302 #pragma omp distribute parallel for simd simdlen(4, 8) 303 for (i = 0; i < 16; ++i) 304 ; 305 #pragma omp target 306 #pragma omp teams 307 // expected-error@+1 {{expression is not an integer constant expression}} 308 #pragma omp distribute parallel for simd simdlen(2.5) 309 for (i = 0; i < 16; ++i) 310 ; 311 #pragma omp target 312 #pragma omp teams 313 // expected-error@+1 {{expression is not an integer constant expression}} 314 #pragma omp distribute parallel for simd simdlen(foo()) 315 for (i = 0; i < 16; ++i) 316 ; 317 #pragma omp target 318 #pragma omp teams 319 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}} 320 #pragma omp distribute parallel for simd simdlen(-5) 321 for (i = 0; i < 16; ++i) 322 ; 323 #pragma omp target 324 #pragma omp teams 325 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}} 326 #pragma omp distribute parallel for simd simdlen(0) 327 for (i = 0; i < 16; ++i) 328 ; 329 #pragma omp target 330 #pragma omp teams 331 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}} 332 #pragma omp distribute parallel for simd simdlen(5 - 5) 333 for (i = 0; i < 16; ++i) 334 ; 335 } 336 337 void test_collapse() { 338 int i; 339 #pragma omp target 340 #pragma omp teams 341 // expected-error@+1 {{expected '('}} 342 #pragma omp distribute parallel for simd collapse 343 for (i = 0; i < 16; ++i) 344 ; 345 #pragma omp target 346 #pragma omp teams 347 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 348 #pragma omp distribute parallel for simd collapse( 349 for (i = 0; i < 16; ++i) 350 ; 351 #pragma omp target 352 #pragma omp teams 353 // expected-error@+1 {{expected expression}} 354 #pragma omp distribute parallel for simd collapse() 355 for (i = 0; i < 16; ++i) 356 ; 357 #pragma omp target 358 #pragma omp teams 359 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 360 #pragma omp distribute parallel for simd collapse(, 361 for (i = 0; i < 16; ++i) 362 ; 363 #pragma omp target 364 #pragma omp teams 365 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 366 #pragma omp distribute parallel for simd collapse(, ) 367 for (i = 0; i < 16; ++i) 368 ; 369 #pragma omp target 370 #pragma omp teams 371 // expected-warning@+2 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} 372 // expected-error@+1 {{expected '('}} 373 #pragma omp distribute parallel for simd collapse 4) 374 for (i = 0; i < 16; ++i) 375 ; 376 #pragma omp target 377 #pragma omp teams 378 // expected-error@+2 {{expected ')'}} 379 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} 380 #pragma omp distribute parallel for simd collapse(4 381 for (i = 0; i < 16; ++i) 382 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}} 383 #pragma omp target 384 #pragma omp teams 385 // expected-error@+2 {{expected ')'}} 386 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} 387 #pragma omp distribute parallel for simd collapse(4, 388 for (i = 0; i < 16; ++i) 389 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}} 390 #pragma omp target 391 #pragma omp teams 392 // expected-error@+2 {{expected ')'}} 393 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} 394 #pragma omp distribute parallel for simd collapse(4, ) 395 for (i = 0; i < 16; ++i) 396 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}} 397 #pragma omp target 398 #pragma omp teams 399 // expected-note@+1 {{as specified in 'collapse' clause}} 400 #pragma omp distribute parallel for simd collapse(4) 401 for (i = 0; i < 16; ++i) 402 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}} 403 #pragma omp target 404 #pragma omp teams 405 // expected-error@+2 {{expected ')'}} 406 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} 407 #pragma omp distribute parallel for simd collapse(4 4) 408 for (i = 0; i < 16; ++i) 409 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}} 410 #pragma omp target 411 #pragma omp teams 412 // expected-error@+2 {{expected ')'}} 413 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} 414 #pragma omp distribute parallel for simd collapse(4, , 4) 415 for (i = 0; i < 16; ++i) 416 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}} 417 #pragma omp target 418 #pragma omp teams 419 #pragma omp distribute parallel for simd collapse(4) 420 for (int i1 = 0; i1 < 16; ++i1) 421 for (int i2 = 0; i2 < 16; ++i2) 422 for (int i3 = 0; i3 < 16; ++i3) 423 for (int i4 = 0; i4 < 16; ++i4) 424 foo(); 425 #pragma omp target 426 #pragma omp teams 427 // expected-error@+2 {{expected ')'}} 428 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} 429 #pragma omp distribute parallel for simd collapse(4, 8) 430 for (i = 0; i < 16; ++i) 431 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}} 432 #pragma omp target 433 #pragma omp teams 434 // expected-error@+1 {{expression is not an integer constant expression}} 435 #pragma omp distribute parallel for simd collapse(2.5) 436 for (i = 0; i < 16; ++i) 437 ; 438 #pragma omp target 439 #pragma omp teams 440 // expected-error@+1 {{expression is not an integer constant expression}} 441 #pragma omp distribute parallel for simd collapse(foo()) 442 for (i = 0; i < 16; ++i) 443 ; 444 #pragma omp target 445 #pragma omp teams 446 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} 447 #pragma omp distribute parallel for simd collapse(-5) 448 for (i = 0; i < 16; ++i) 449 ; 450 #pragma omp target 451 #pragma omp teams 452 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} 453 #pragma omp distribute parallel for simd collapse(0) 454 for (i = 0; i < 16; ++i) 455 ; 456 #pragma omp target 457 #pragma omp teams 458 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} 459 #pragma omp distribute parallel for simd collapse(5 - 5) 460 for (i = 0; i < 16; ++i) 461 ; 462 #pragma omp target 463 #pragma omp teams 464 #pragma omp distribute parallel for simd collapse(2) 465 for (i = 0; i < 16; ++i) 466 for (int j = 0; j < 16; ++j) 467 // expected-error@+1 {{OpenMP constructs may not be nested inside a simd region}} 468 #pragma omp distribute parallel for simd reduction(+ : i, j) 469 for (int k = 0; k < 16; ++k) 470 i += j; 471 } 472 473 void test_linear() { 474 int i; 475 #pragma omp target 476 #pragma omp teams 477 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 478 #pragma omp distribute parallel for simd linear( 479 for (i = 0; i < 16; ++i) 480 ; 481 #pragma omp target 482 #pragma omp teams 483 // expected-error@+2 {{expected expression}} 484 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 485 #pragma omp distribute parallel for simd linear(, 486 for (i = 0; i < 16; ++i) 487 ; 488 #pragma omp target 489 #pragma omp teams 490 // expected-error@+2 {{expected expression}} 491 // expected-error@+1 {{expected expression}} 492 #pragma omp distribute parallel for simd linear(, ) 493 for (i = 0; i < 16; ++i) 494 ; 495 #pragma omp target 496 #pragma omp teams 497 // expected-error@+1 {{expected expression}} 498 #pragma omp distribute parallel for simd linear() 499 for (i = 0; i < 16; ++i) 500 ; 501 #pragma omp target 502 #pragma omp teams 503 // expected-error@+1 {{expected expression}} 504 #pragma omp distribute parallel for simd linear(int) 505 for (i = 0; i < 16; ++i) 506 ; 507 #pragma omp target 508 #pragma omp teams 509 // expected-error@+1 {{expected variable name}} 510 #pragma omp distribute parallel for simd linear(0) 511 for (i = 0; i < 16; ++i) 512 ; 513 #pragma omp target 514 #pragma omp teams 515 // expected-error@+1 {{use of undeclared identifier 'x'}} 516 #pragma omp distribute parallel for simd linear(x) 517 for (i = 0; i < 16; ++i) 518 ; 519 #pragma omp target 520 #pragma omp teams 521 // expected-error@+2 {{use of undeclared identifier 'x'}} 522 // expected-error@+1 {{use of undeclared identifier 'y'}} 523 #pragma omp distribute parallel for simd linear(x, y) 524 for (i = 0; i < 16; ++i) 525 ; 526 #pragma omp target 527 #pragma omp teams 528 // expected-error@+3 {{use of undeclared identifier 'x'}} 529 // expected-error@+2 {{use of undeclared identifier 'y'}} 530 // expected-error@+1 {{use of undeclared identifier 'z'}} 531 #pragma omp distribute parallel for simd linear(x, y, z) 532 for (i = 0; i < 16; ++i) 533 ; 534 535 int x, y; 536 #pragma omp target 537 #pragma omp teams 538 // expected-error@+1 {{expected expression}} 539 #pragma omp distribute parallel for simd linear(x :) 540 for (i = 0; i < 16; ++i) 541 ; 542 #pragma omp target 543 #pragma omp teams 544 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 545 #pragma omp distribute parallel for simd linear(x :, ) 546 for (i = 0; i < 16; ++i) 547 ; 548 #pragma omp target 549 #pragma omp teams 550 #pragma omp distribute parallel for simd linear(x : 1) 551 for (i = 0; i < 16; ++i) 552 ; 553 #pragma omp target 554 #pragma omp teams 555 #pragma omp distribute parallel for simd linear(x : 2 * 2) 556 for (i = 0; i < 16; ++i) 557 ; 558 #pragma omp target 559 #pragma omp teams 560 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 561 #pragma omp distribute parallel for simd linear(x : 1, y) 562 for (i = 0; i < 16; ++i) 563 ; 564 #pragma omp target 565 #pragma omp teams 566 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 567 #pragma omp distribute parallel for simd linear(x : 1, y, z : 1) 568 for (i = 0; i < 16; ++i) 569 ; 570 571 #pragma omp target 572 #pragma omp teams 573 // expected-note@+2 {{defined as linear}} 574 // expected-error@+1 {{linear variable cannot be linear}} 575 #pragma omp distribute parallel for simd linear(x) linear(x) 576 for (i = 0; i < 16; ++i) 577 ; 578 579 #pragma omp target 580 #pragma omp teams 581 // expected-note@+2 {{defined as private}} 582 // expected-error@+1 {{private variable cannot be linear}} 583 #pragma omp distribute parallel for simd private(x) linear(x) 584 for (i = 0; i < 16; ++i) 585 ; 586 587 #pragma omp target 588 #pragma omp teams 589 // expected-note@+2 {{defined as linear}} 590 // expected-error@+1 {{linear variable cannot be private}} 591 #pragma omp distribute parallel for simd linear(x) private(x) 592 for (i = 0; i < 16; ++i) 593 ; 594 595 #pragma omp target 596 #pragma omp teams 597 // expected-warning@+1 {{zero linear step (x and other variables in clause should probably be const)}} 598 #pragma omp distribute parallel for simd linear(x, y : 0) 599 for (i = 0; i < 16; ++i) 600 ; 601 602 #pragma omp target 603 #pragma omp teams 604 // expected-note@+2 {{defined as linear}} 605 // expected-error@+1 {{linear variable cannot be lastprivate}} 606 #pragma omp distribute parallel for simd linear(x) lastprivate(x) 607 for (i = 0; i < 16; ++i) 608 ; 609 610 #pragma omp target 611 #pragma omp teams 612 // expected-note@+2 {{defined as lastprivate}} 613 // expected-error@+1 {{lastprivate variable cannot be linear}} 614 #pragma omp distribute parallel for simd lastprivate(x) linear(x) 615 for (i = 0; i < 16; ++i) 616 ; 617 } 618 619 void test_aligned() { 620 int i; 621 #pragma omp target 622 #pragma omp teams 623 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 624 #pragma omp distribute parallel for simd aligned( 625 for (i = 0; i < 16; ++i) 626 ; 627 // expected-error@+2 {{expected expression}} 628 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 629 #pragma omp distribute parallel for simd aligned(, 630 for (i = 0; i < 16; ++i) 631 ; 632 #pragma omp target 633 #pragma omp teams 634 // expected-error@+2 {{expected expression}} 635 // expected-error@+1 {{expected expression}} 636 #pragma omp distribute parallel for simd aligned(, ) 637 for (i = 0; i < 16; ++i) 638 ; 639 #pragma omp target 640 #pragma omp teams 641 // expected-error@+1 {{expected expression}} 642 #pragma omp distribute parallel for simd aligned() 643 for (i = 0; i < 16; ++i) 644 ; 645 #pragma omp target 646 #pragma omp teams 647 // expected-error@+1 {{expected expression}} 648 #pragma omp distribute parallel for simd aligned(int) 649 for (i = 0; i < 16; ++i) 650 ; 651 #pragma omp target 652 #pragma omp teams 653 // expected-error@+1 {{expected variable name}} 654 #pragma omp distribute parallel for simd aligned(0) 655 for (i = 0; i < 16; ++i) 656 ; 657 #pragma omp target 658 #pragma omp teams 659 // expected-error@+1 {{use of undeclared identifier 'x'}} 660 #pragma omp distribute parallel for simd aligned(x) 661 for (i = 0; i < 16; ++i) 662 ; 663 #pragma omp target 664 #pragma omp teams 665 // expected-error@+2 {{use of undeclared identifier 'x'}} 666 // expected-error@+1 {{use of undeclared identifier 'y'}} 667 #pragma omp distribute parallel for simd aligned(x, y) 668 for (i = 0; i < 16; ++i) 669 ; 670 #pragma omp target 671 #pragma omp teams 672 // expected-error@+3 {{use of undeclared identifier 'x'}} 673 // expected-error@+2 {{use of undeclared identifier 'y'}} 674 // expected-error@+1 {{use of undeclared identifier 'z'}} 675 #pragma omp distribute parallel for simd aligned(x, y, z) 676 for (i = 0; i < 16; ++i) 677 ; 678 679 int *x, y, z[25]; // expected-note 4 {{'y' defined here}} 680 #pragma omp target 681 #pragma omp teams 682 #pragma omp distribute parallel for simd aligned(x) 683 for (i = 0; i < 16; ++i) 684 ; 685 #pragma omp target 686 #pragma omp teams 687 #pragma omp distribute parallel for simd aligned(z) 688 for (i = 0; i < 16; ++i) 689 ; 690 #pragma omp target 691 #pragma omp teams 692 // expected-error@+1 {{expected expression}} 693 #pragma omp distribute parallel for simd aligned(x :) 694 for (i = 0; i < 16; ++i) 695 ; 696 #pragma omp target 697 #pragma omp teams 698 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 699 #pragma omp distribute parallel for simd aligned(x :, ) 700 for (i = 0; i < 16; ++i) 701 ; 702 #pragma omp target 703 #pragma omp teams 704 #pragma omp distribute parallel for simd aligned(x : 1) 705 for (i = 0; i < 16; ++i) 706 ; 707 #pragma omp target 708 #pragma omp teams 709 #pragma omp distribute parallel for simd aligned(x : 2 * 2) 710 for (i = 0; i < 16; ++i) 711 ; 712 #pragma omp target 713 #pragma omp teams 714 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 715 #pragma omp distribute parallel for simd aligned(x : 1, y) 716 for (i = 0; i < 16; ++i) 717 ; 718 #pragma omp target 719 #pragma omp teams 720 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 721 #pragma omp distribute parallel for simd aligned(x : 1, y, z : 1) 722 for (i = 0; i < 16; ++i) 723 ; 724 725 #pragma omp target 726 #pragma omp teams 727 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}} 728 #pragma omp distribute parallel for simd aligned(x, y) 729 for (i = 0; i < 16; ++i) 730 ; 731 #pragma omp target 732 #pragma omp teams 733 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}} 734 #pragma omp distribute parallel for simd aligned(x, y, z) 735 for (i = 0; i < 16; ++i) 736 ; 737 738 #pragma omp target 739 #pragma omp teams 740 // expected-note@+2 {{defined as aligned}} 741 // expected-error@+1 {{a variable cannot appear in more than one aligned clause}} 742 #pragma omp distribute parallel for simd aligned(x) aligned(z, x) 743 for (i = 0; i < 16; ++i) 744 ; 745 746 #pragma omp target 747 #pragma omp teams 748 // expected-note@+3 {{defined as aligned}} 749 // expected-error@+2 {{a variable cannot appear in more than one aligned clause}} 750 // expected-error@+1 2 {{argument of aligned clause should be array or pointer, not 'int'}} 751 #pragma omp distribute parallel for simd aligned(x, y, z) aligned(y, z) 752 for (i = 0; i < 16; ++i) 753 ; 754 } 755 756 757 void test_private() { 758 int i; 759 #pragma omp target 760 #pragma omp teams 761 // expected-error@+2 {{expected expression}} 762 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} 763 #pragma omp distribute parallel for simd private( 764 for (i = 0; i < 16; ++i) 765 ; 766 #pragma omp target 767 #pragma omp teams 768 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} 769 // expected-error@+1 2 {{expected expression}} 770 #pragma omp distribute parallel for simd private(, 771 for (i = 0; i < 16; ++i) 772 ; 773 #pragma omp target 774 #pragma omp teams 775 // expected-error@+1 2 {{expected expression}} 776 #pragma omp distribute parallel for simd private(, ) 777 for (i = 0; i < 16; ++i) 778 ; 779 #pragma omp target 780 #pragma omp teams 781 // expected-error@+1 {{expected expression}} 782 #pragma omp distribute parallel for simd private() 783 for (i = 0; i < 16; ++i) 784 ; 785 #pragma omp target 786 #pragma omp teams 787 // expected-error@+1 {{expected expression}} 788 #pragma omp distribute parallel for simd private(int) 789 for (i = 0; i < 16; ++i) 790 ; 791 #pragma omp target 792 #pragma omp teams 793 // expected-error@+1 {{expected variable name}} 794 #pragma omp distribute parallel for simd private(0) 795 for (i = 0; i < 16; ++i) 796 ; 797 798 int x, y, z; 799 #pragma omp target 800 #pragma omp teams 801 #pragma omp distribute parallel for simd private(x) 802 for (i = 0; i < 16; ++i) 803 ; 804 #pragma omp target 805 #pragma omp teams 806 #pragma omp distribute parallel for simd private(x, y) 807 for (i = 0; i < 16; ++i) 808 ; 809 #pragma omp target 810 #pragma omp teams 811 #pragma omp distribute parallel for simd private(x, y, z) 812 for (i = 0; i < 16; ++i) { 813 x = y * i + z; 814 } 815 } 816 817 void test_lastprivate() { 818 int i; 819 #pragma omp target 820 #pragma omp teams 821 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} 822 // expected-error@+1 {{expected expression}} 823 #pragma omp distribute parallel for simd lastprivate( 824 for (i = 0; i < 16; ++i) 825 ; 826 827 #pragma omp target 828 #pragma omp teams 829 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} 830 // expected-error@+1 2 {{expected expression}} 831 #pragma omp distribute parallel for simd lastprivate(, 832 for (i = 0; i < 16; ++i) 833 ; 834 #pragma omp target 835 #pragma omp teams 836 // expected-error@+1 2 {{expected expression}} 837 #pragma omp distribute parallel for simd lastprivate(, ) 838 for (i = 0; i < 16; ++i) 839 ; 840 #pragma omp target 841 #pragma omp teams 842 // expected-error@+1 {{expected expression}} 843 #pragma omp distribute parallel for simd lastprivate() 844 for (i = 0; i < 16; ++i) 845 ; 846 #pragma omp target 847 #pragma omp teams 848 // expected-error@+1 {{expected expression}} 849 #pragma omp distribute parallel for simd lastprivate(int) 850 for (i = 0; i < 16; ++i) 851 ; 852 #pragma omp target 853 #pragma omp teams 854 // expected-error@+1 {{expected variable name}} 855 #pragma omp distribute parallel for simd lastprivate(0) 856 for (i = 0; i < 16; ++i) 857 ; 858 859 int x, y, z; 860 #pragma omp target 861 #pragma omp teams 862 #pragma omp distribute parallel for simd lastprivate(x) 863 for (i = 0; i < 16; ++i) 864 ; 865 #pragma omp target 866 #pragma omp teams 867 #pragma omp distribute parallel for simd lastprivate(x, y) 868 for (i = 0; i < 16; ++i) 869 ; 870 #pragma omp target 871 #pragma omp teams 872 #pragma omp distribute parallel for simd lastprivate(x, y, z) 873 for (i = 0; i < 16; ++i) 874 ; 875 } 876 877 void test_firstprivate() { 878 int i; 879 #pragma omp target 880 #pragma omp teams 881 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} 882 // expected-error@+1 {{expected expression}} 883 #pragma omp distribute parallel for simd firstprivate( 884 for (i = 0; i < 16; ++i) 885 ; 886 887 #pragma omp target 888 #pragma omp teams 889 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} 890 // expected-error@+1 2 {{expected expression}} 891 #pragma omp distribute parallel for simd firstprivate(, 892 for (i = 0; i < 16; ++i) 893 ; 894 #pragma omp target 895 #pragma omp teams 896 // expected-error@+1 2 {{expected expression}} 897 #pragma omp distribute parallel for simd firstprivate(, ) 898 for (i = 0; i < 16; ++i) 899 ; 900 #pragma omp target 901 #pragma omp teams 902 // expected-error@+1 {{expected expression}} 903 #pragma omp distribute parallel for simd firstprivate() 904 for (i = 0; i < 16; ++i) 905 ; 906 #pragma omp target 907 #pragma omp teams 908 // expected-error@+1 {{expected expression}} 909 #pragma omp distribute parallel for simd firstprivate(int) 910 for (i = 0; i < 16; ++i) 911 ; 912 #pragma omp target 913 #pragma omp teams 914 // expected-error@+1 {{expected variable name}} 915 #pragma omp distribute parallel for simd firstprivate(0) 916 for (i = 0; i < 16; ++i) 917 ; 918 919 int x, y, z; 920 #pragma omp target 921 #pragma omp teams 922 #pragma omp distribute parallel for simd lastprivate(x) firstprivate(x) 923 for (i = 0; i < 16; ++i) 924 ; 925 #pragma omp target 926 #pragma omp teams 927 #pragma omp distribute parallel for simd lastprivate(x, y) firstprivate(x, y) 928 for (i = 0; i < 16; ++i) 929 ; 930 #pragma omp target 931 #pragma omp teams 932 #pragma omp distribute parallel for simd lastprivate(x, y, z) firstprivate(x, y, z) 933 for (i = 0; i < 16; ++i) 934 ; 935 } 936 937 void test_loop_messages() { 938 float a[100], b[100], c[100]; 939 #pragma omp target 940 #pragma omp teams 941 // expected-error@+2 {{variable must be of integer or pointer type}} 942 #pragma omp distribute parallel for simd 943 for (float fi = 0; fi < 10.0; fi++) { 944 c[(int)fi] = a[(int)fi] + b[(int)fi]; 945 } 946 #pragma omp target 947 #pragma omp teams 948 // expected-error@+2 {{variable must be of integer or pointer type}} 949 #pragma omp distribute parallel for simd 950 for (double fi = 0; fi < 10.0; fi++) { 951 c[(int)fi] = a[(int)fi] + b[(int)fi]; 952 } 953 } 954 955