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