Home | History | Annotate | Download | only in OpenMP
      1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s
      2 
      3 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel for simd'}}
      4 #pragma omp parallel for simd
      5 
      6 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel for simd'}}
      7 #pragma omp parallel for simd foo
      8 
      9 void test_no_clause() {
     10   int i;
     11 #pragma omp parallel for simd
     12   for (i = 0; i < 16; ++i)
     13     ;
     14 
     15 // expected-error@+2 {{statement after '#pragma omp parallel for simd' must be a for loop}}
     16 #pragma omp 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 parallel
     28 #pragma omp parallel 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 parallel for simd' are ignored}}
     52 #pragma omp parallel 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 parallel for simd' are ignored}}
     62 #pragma omp parallel 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 parallel for simd' are ignored}}
     67 #pragma omp parallel 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 parallel for simd' are ignored}}
     73 #pragma omp parallel 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 parallel for simd' are ignored}}
     79 #pragma omp parallel 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 parallel 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 parallel for simd safelen(
     93   for (i = 0; i < 16; ++i)
     94     ;
     95 // expected-error@+1 {{expected expression}}
     96 #pragma omp parallel 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 parallel 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 parallel for simd safelen(, )
    105   for (i = 0; i < 16; ++i)
    106     ;
    107 // expected-warning@+2 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
    108 // expected-error@+1 {{expected '('}}
    109 #pragma omp parallel 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 parallel 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 parallel 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 parallel for simd safelen(4, )
    125   for (i = 0; i < 16; ++i)
    126     ;
    127 #pragma omp parallel 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 parallel 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 parallel for simd safelen(4, , 4)
    138   for (i = 0; i < 16; ++i)
    139     ;
    140 #pragma omp parallel 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 parallel 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 parallel 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 parallel for simd safelen(foo())
    154   for (i = 0; i < 16; ++i)
    155     ;
    156 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
    157 #pragma omp parallel for simd safelen(-5)
    158   for (i = 0; i < 16; ++i)
    159     ;
    160 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
    161 #pragma omp parallel for simd safelen(0)
    162   for (i = 0; i < 16; ++i)
    163     ;
    164 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
    165 #pragma omp parallel for simd safelen(5 - 5)
    166   for (i = 0; i < 16; ++i)
    167     ;
    168 }
    169 
    170 void test_simdlen() {
    171   int i;
    172 // expected-error@+1 {{expected '('}}
    173 #pragma omp parallel for simd simdlen
    174   for (i = 0; i < 16; ++i)
    175     ;
    176 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    177 #pragma omp parallel for simd simdlen(
    178   for (i = 0; i < 16; ++i)
    179     ;
    180 // expected-error@+1 {{expected expression}}
    181 #pragma omp parallel for simd simdlen()
    182   for (i = 0; i < 16; ++i)
    183     ;
    184 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    185 #pragma omp parallel for simd simdlen(,
    186   for (i = 0; i < 16; ++i)
    187     ;
    188 // expected-error@+1 {{expected expression}}  expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    189 #pragma omp parallel for simd simdlen(, )
    190   for (i = 0; i < 16; ++i)
    191     ;
    192 // expected-warning@+2 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
    193 // expected-error@+1 {{expected '('}}
    194 #pragma omp parallel for simd simdlen 4)
    195   for (i = 0; i < 16; ++i)
    196     ;
    197 // expected-error@+2 {{expected ')'}}
    198 // expected-note@+1 {{to match this '('}}
    199 #pragma omp parallel for simd simdlen(4
    200   for (i = 0; i < 16; ++i)
    201     ;
    202 // expected-error@+2 {{expected ')'}}
    203 // expected-note@+1 {{to match this '('}}
    204 #pragma omp parallel for simd simdlen(4,
    205   for (i = 0; i < 16; ++i)
    206     ;
    207 // expected-error@+2 {{expected ')'}}
    208 // expected-note@+1 {{to match this '('}}
    209 #pragma omp parallel for simd simdlen(4, )
    210   for (i = 0; i < 16; ++i)
    211     ;
    212 #pragma omp parallel for simd simdlen(4)
    213   for (i = 0; i < 16; ++i)
    214     ;
    215 // expected-error@+2 {{expected ')'}}
    216 // expected-note@+1 {{to match this '('}}
    217 #pragma omp parallel for simd simdlen(4 4)
    218   for (i = 0; i < 16; ++i)
    219     ;
    220 // expected-error@+2 {{expected ')'}}
    221 // expected-note@+1 {{to match this '('}}
    222 #pragma omp parallel for simd simdlen(4, , 4)
    223   for (i = 0; i < 16; ++i)
    224     ;
    225 #pragma omp parallel for simd simdlen(4)
    226   for (i = 0; i < 16; ++i)
    227     ;
    228 // expected-error@+2 {{expected ')'}}
    229 // expected-note@+1 {{to match this '('}}
    230 #pragma omp parallel for simd simdlen(4, 8)
    231   for (i = 0; i < 16; ++i)
    232     ;
    233 // expected-error@+1 {{expression is not an integer constant expression}}
    234 #pragma omp parallel for simd simdlen(2.5)
    235   for (i = 0; i < 16; ++i)
    236     ;
    237 // expected-error@+1 {{expression is not an integer constant expression}}
    238 #pragma omp parallel for simd simdlen(foo())
    239   for (i = 0; i < 16; ++i)
    240     ;
    241 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
    242 #pragma omp parallel for simd simdlen(-5)
    243   for (i = 0; i < 16; ++i)
    244     ;
    245 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
    246 #pragma omp parallel for simd simdlen(0)
    247   for (i = 0; i < 16; ++i)
    248     ;
    249 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
    250 #pragma omp parallel for simd simdlen(5 - 5)
    251   for (i = 0; i < 16; ++i)
    252     ;
    253 }
    254 
    255 void test_safelen_simdlen() {
    256   int i;
    257 // expected-error@+1 {{the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter}}
    258 #pragma omp parallel for simd simdlen(6) safelen(5)
    259   for (i = 0; i < 16; ++i)
    260     ;
    261 // expected-error@+1 {{the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter}}
    262 #pragma omp parallel for simd safelen(5) simdlen(6)
    263   for (i = 0; i < 16; ++i)
    264     ;
    265 }
    266 
    267 void test_collapse() {
    268   int i;
    269 #pragma omp parallel
    270 // expected-error@+1 {{expected '('}}
    271 #pragma omp parallel for simd collapse
    272   for (i = 0; i < 16; ++i)
    273     ;
    274 #pragma omp parallel
    275 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    276 #pragma omp parallel for simd collapse(
    277   for (i = 0; i < 16; ++i)
    278     ;
    279 #pragma omp parallel
    280 // expected-error@+1 {{expected expression}}
    281 #pragma omp parallel for simd collapse()
    282   for (i = 0; i < 16; ++i)
    283     ;
    284 #pragma omp parallel
    285 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    286 #pragma omp parallel for simd collapse(,
    287   for (i = 0; i < 16; ++i)
    288     ;
    289 #pragma omp parallel
    290 // expected-error@+1 {{expected expression}}  expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    291 #pragma omp parallel for simd collapse(, )
    292   for (i = 0; i < 16; ++i)
    293     ;
    294 #pragma omp parallel
    295 // expected-warning@+2 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
    296 // expected-error@+1 {{expected '('}}
    297 #pragma omp parallel for simd collapse 4)
    298   for (i = 0; i < 16; ++i)
    299     ;
    300 #pragma omp parallel
    301 // expected-error@+2 {{expected ')'}}
    302 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
    303 #pragma omp parallel for simd collapse(4
    304   for (i = 0; i < 16; ++i)
    305     ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
    306 #pragma omp parallel
    307 // expected-error@+2 {{expected ')'}}
    308 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
    309 #pragma omp parallel for simd collapse(4,
    310   for (i = 0; i < 16; ++i)
    311     ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
    312 #pragma omp parallel
    313 // expected-error@+2 {{expected ')'}}
    314 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
    315 #pragma omp parallel for simd collapse(4, )
    316   for (i = 0; i < 16; ++i)
    317     ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
    318 #pragma omp parallel
    319 // expected-note@+1 {{as specified in 'collapse' clause}}
    320 #pragma omp parallel for simd collapse(4)
    321   for (i = 0; i < 16; ++i)
    322     ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
    323 #pragma omp parallel
    324 // expected-error@+2 {{expected ')'}}
    325 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
    326 #pragma omp parallel for simd collapse(4 4)
    327   for (i = 0; i < 16; ++i)
    328     ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
    329 #pragma omp parallel
    330 // expected-error@+2 {{expected ')'}}
    331 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
    332 #pragma omp parallel for simd collapse(4, , 4)
    333   for (i = 0; i < 16; ++i)
    334     ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
    335 #pragma omp parallel
    336 #pragma omp parallel for simd collapse(4)
    337   for (int i1 = 0; i1 < 16; ++i1)
    338     for (int i2 = 0; i2 < 16; ++i2)
    339       for (int i3 = 0; i3 < 16; ++i3)
    340         for (int i4 = 0; i4 < 16; ++i4)
    341           foo();
    342 #pragma omp parallel
    343 // expected-error@+2 {{expected ')'}}
    344 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
    345 #pragma omp parallel for simd collapse(4, 8)
    346   for (i = 0; i < 16; ++i)
    347     ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
    348 #pragma omp parallel
    349 // expected-error@+1 {{expression is not an integer constant expression}}
    350 #pragma omp parallel for simd collapse(2.5)
    351   for (i = 0; i < 16; ++i)
    352     ;
    353 #pragma omp parallel
    354 // expected-error@+1 {{expression is not an integer constant expression}}
    355 #pragma omp parallel for simd collapse(foo())
    356   for (i = 0; i < 16; ++i)
    357     ;
    358 #pragma omp parallel
    359 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
    360 #pragma omp parallel for simd collapse(-5)
    361   for (i = 0; i < 16; ++i)
    362     ;
    363 #pragma omp parallel
    364 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
    365 #pragma omp parallel for simd collapse(0)
    366   for (i = 0; i < 16; ++i)
    367     ;
    368 #pragma omp parallel
    369 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
    370 #pragma omp parallel for simd collapse(5 - 5)
    371   for (i = 0; i < 16; ++i)
    372     ;
    373 #pragma omp parallel
    374 #pragma omp parallel for simd collapse(2)
    375   for (i = 0; i < 16; ++i)
    376     for (int j = 0; j < 16; ++j)
    377 // expected-error@+1 {{OpenMP constructs may not be nested inside a simd region}}
    378 #pragma omp parallel for simd reduction(+ : i, j)
    379       for (int k = 0; k < 16; ++k)
    380         i += j;
    381 }
    382 
    383 void test_linear() {
    384   int i;
    385 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    386 #pragma omp parallel for simd linear(
    387   for (i = 0; i < 16; ++i)
    388     ;
    389 // expected-error@+2 {{expected expression}}
    390 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    391 #pragma omp parallel for simd linear(,
    392   for (i = 0; i < 16; ++i)
    393     ;
    394 // expected-error@+2 {{expected expression}}
    395 // expected-error@+1 {{expected expression}}
    396 #pragma omp parallel for simd linear(, )
    397   for (i = 0; i < 16; ++i)
    398     ;
    399 // expected-error@+1 {{expected expression}}
    400 #pragma omp parallel for simd linear()
    401   for (i = 0; i < 16; ++i)
    402     ;
    403 // expected-error@+1 {{expected expression}}
    404 #pragma omp parallel for simd linear(int)
    405   for (i = 0; i < 16; ++i)
    406     ;
    407 // expected-error@+1 {{expected variable name}}
    408 #pragma omp parallel for simd linear(0)
    409   for (i = 0; i < 16; ++i)
    410     ;
    411 // expected-error@+1 {{use of undeclared identifier 'x'}}
    412 #pragma omp parallel for simd linear(x)
    413   for (i = 0; i < 16; ++i)
    414     ;
    415 // expected-error@+2 {{use of undeclared identifier 'x'}}
    416 // expected-error@+1 {{use of undeclared identifier 'y'}}
    417 #pragma omp parallel for simd linear(x, y)
    418   for (i = 0; i < 16; ++i)
    419     ;
    420 // expected-error@+3 {{use of undeclared identifier 'x'}}
    421 // expected-error@+2 {{use of undeclared identifier 'y'}}
    422 // expected-error@+1 {{use of undeclared identifier 'z'}}
    423 #pragma omp parallel for simd linear(x, y, z)
    424   for (i = 0; i < 16; ++i)
    425     ;
    426 
    427   int x, y;
    428 // expected-error@+1 {{expected expression}}
    429 #pragma omp parallel for simd linear(x :)
    430   for (i = 0; i < 16; ++i)
    431     ;
    432 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    433 #pragma omp parallel for simd linear(x :, )
    434   for (i = 0; i < 16; ++i)
    435     ;
    436 #pragma omp parallel for simd linear(x : 1)
    437   for (i = 0; i < 16; ++i)
    438     ;
    439 #pragma omp parallel for simd linear(x : 2 * 2)
    440   for (i = 0; i < 16; ++i)
    441     ;
    442 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    443 #pragma omp parallel for simd linear(x : 1, y)
    444   for (i = 0; i < 16; ++i)
    445     ;
    446 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    447 #pragma omp parallel for simd linear(x : 1, y, z : 1)
    448   for (i = 0; i < 16; ++i)
    449     ;
    450 
    451 // expected-note@+2 {{defined as linear}}
    452 // expected-error@+1 {{linear variable cannot be linear}}
    453 #pragma omp parallel for simd linear(x) linear(x)
    454   for (i = 0; i < 16; ++i)
    455     ;
    456 
    457 // expected-note@+2 {{defined as private}}
    458 // expected-error@+1 {{private variable cannot be linear}}
    459 #pragma omp parallel for simd private(x) linear(x)
    460   for (i = 0; i < 16; ++i)
    461     ;
    462 
    463 // expected-note@+2 {{defined as linear}}
    464 // expected-error@+1 {{linear variable cannot be private}}
    465 #pragma omp parallel for simd linear(x) private(x)
    466   for (i = 0; i < 16; ++i)
    467     ;
    468 
    469 // expected-warning@+1 {{zero linear step (x and other variables in clause should probably be const)}}
    470 #pragma omp parallel for simd linear(x, y : 0)
    471   for (i = 0; i < 16; ++i)
    472     ;
    473 
    474 // expected-note@+2 {{defined as linear}}
    475 // expected-error@+1 {{linear variable cannot be lastprivate}}
    476 #pragma omp parallel for simd linear(x) lastprivate(x)
    477   for (i = 0; i < 16; ++i)
    478     ;
    479 
    480 #pragma omp parallel
    481 // expected-note@+2 {{defined as lastprivate}}
    482 // expected-error@+1 {{lastprivate variable cannot be linear}}
    483 #pragma omp parallel for simd lastprivate(x) linear(x)
    484   for (i = 0; i < 16; ++i)
    485     ;
    486 }
    487 
    488 void test_aligned() {
    489   int i;
    490 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    491 #pragma omp parallel for simd aligned(
    492   for (i = 0; i < 16; ++i)
    493     ;
    494 // expected-error@+2 {{expected expression}}
    495 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    496 #pragma omp parallel for simd aligned(,
    497   for (i = 0; i < 16; ++i)
    498     ;
    499 // expected-error@+2 {{expected expression}}
    500 // expected-error@+1 {{expected expression}}
    501 #pragma omp parallel for simd aligned(, )
    502   for (i = 0; i < 16; ++i)
    503     ;
    504 // expected-error@+1 {{expected expression}}
    505 #pragma omp parallel for simd aligned()
    506   for (i = 0; i < 16; ++i)
    507     ;
    508 // expected-error@+1 {{expected expression}}
    509 #pragma omp parallel for simd aligned(int)
    510   for (i = 0; i < 16; ++i)
    511     ;
    512 // expected-error@+1 {{expected variable name}}
    513 #pragma omp parallel for simd aligned(0)
    514   for (i = 0; i < 16; ++i)
    515     ;
    516 // expected-error@+1 {{use of undeclared identifier 'x'}}
    517 #pragma omp parallel for simd aligned(x)
    518   for (i = 0; i < 16; ++i)
    519     ;
    520 // expected-error@+2 {{use of undeclared identifier 'x'}}
    521 // expected-error@+1 {{use of undeclared identifier 'y'}}
    522 #pragma omp parallel for simd aligned(x, y)
    523   for (i = 0; i < 16; ++i)
    524     ;
    525 // expected-error@+3 {{use of undeclared identifier 'x'}}
    526 // expected-error@+2 {{use of undeclared identifier 'y'}}
    527 // expected-error@+1 {{use of undeclared identifier 'z'}}
    528 #pragma omp parallel for simd aligned(x, y, z)
    529   for (i = 0; i < 16; ++i)
    530     ;
    531 
    532   int *x, y, z[25]; // expected-note 4 {{'y' defined here}}
    533 #pragma omp parallel for simd aligned(x)
    534   for (i = 0; i < 16; ++i)
    535     ;
    536 #pragma omp parallel for simd aligned(z)
    537   for (i = 0; i < 16; ++i)
    538     ;
    539 // expected-error@+1 {{expected expression}}
    540 #pragma omp parallel for simd aligned(x :)
    541   for (i = 0; i < 16; ++i)
    542     ;
    543 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    544 #pragma omp parallel for simd aligned(x :, )
    545   for (i = 0; i < 16; ++i)
    546     ;
    547 #pragma omp parallel for simd aligned(x : 1)
    548   for (i = 0; i < 16; ++i)
    549     ;
    550 #pragma omp parallel for simd aligned(x : 2 * 2)
    551   for (i = 0; i < 16; ++i)
    552     ;
    553 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    554 #pragma omp parallel for simd aligned(x : 1, y)
    555   for (i = 0; i < 16; ++i)
    556     ;
    557 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    558 #pragma omp parallel for simd aligned(x : 1, y, z : 1)
    559   for (i = 0; i < 16; ++i)
    560     ;
    561 
    562 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
    563 #pragma omp parallel for simd aligned(x, y)
    564   for (i = 0; i < 16; ++i)
    565     ;
    566 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
    567 #pragma omp parallel for simd aligned(x, y, z)
    568   for (i = 0; i < 16; ++i)
    569     ;
    570 
    571 // expected-note@+2 {{defined as aligned}}
    572 // expected-error@+1 {{a variable cannot appear in more than one aligned clause}}
    573 #pragma omp parallel for simd aligned(x) aligned(z, x)
    574   for (i = 0; i < 16; ++i)
    575     ;
    576 
    577 // expected-note@+3 {{defined as aligned}}
    578 // expected-error@+2 {{a variable cannot appear in more than one aligned clause}}
    579 // expected-error@+1 2 {{argument of aligned clause should be array or pointer, not 'int'}}
    580 #pragma omp parallel for simd aligned(x, y, z) aligned(y, z)
    581   for (i = 0; i < 16; ++i)
    582     ;
    583 }
    584 
    585 
    586 void test_private() {
    587   int i;
    588 #pragma omp parallel
    589 // expected-error@+2 {{expected expression}}
    590 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    591 #pragma omp parallel for simd private(
    592   for (i = 0; i < 16; ++i)
    593     ;
    594 #pragma omp parallel
    595 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
    596 // expected-error@+1 2 {{expected expression}}
    597 #pragma omp parallel for simd private(,
    598   for (i = 0; i < 16; ++i)
    599     ;
    600 #pragma omp parallel
    601 // expected-error@+1 2 {{expected expression}}
    602 #pragma omp parallel for simd private(, )
    603   for (i = 0; i < 16; ++i)
    604     ;
    605 #pragma omp parallel
    606 // expected-error@+1 {{expected expression}}
    607 #pragma omp parallel for simd private()
    608   for (i = 0; i < 16; ++i)
    609     ;
    610 #pragma omp parallel
    611 // expected-error@+1 {{expected expression}}
    612 #pragma omp parallel for simd private(int)
    613   for (i = 0; i < 16; ++i)
    614     ;
    615 #pragma omp parallel
    616 // expected-error@+1 {{expected variable name}}
    617 #pragma omp parallel for simd private(0)
    618   for (i = 0; i < 16; ++i)
    619     ;
    620 
    621   int x, y, z;
    622 #pragma omp parallel
    623 #pragma omp parallel for simd private(x)
    624   for (i = 0; i < 16; ++i)
    625     ;
    626 #pragma omp parallel
    627 #pragma omp parallel for simd private(x, y)
    628   for (i = 0; i < 16; ++i)
    629     ;
    630 #pragma omp parallel
    631 #pragma omp parallel for simd private(x, y, z)
    632   for (i = 0; i < 16; ++i) {
    633     x = y * i + z;
    634   }
    635 }
    636 
    637 void test_lastprivate() {
    638   int i;
    639 #pragma omp parallel
    640 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
    641 // expected-error@+1 {{expected expression}}
    642 #pragma omp parallel for simd lastprivate(
    643   for (i = 0; i < 16; ++i)
    644     ;
    645 
    646 #pragma omp parallel
    647 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
    648 // expected-error@+1 2 {{expected expression}}
    649 #pragma omp parallel for simd lastprivate(,
    650   for (i = 0; i < 16; ++i)
    651     ;
    652 #pragma omp parallel
    653 // expected-error@+1 2 {{expected expression}}
    654 #pragma omp parallel for simd lastprivate(, )
    655   for (i = 0; i < 16; ++i)
    656     ;
    657 #pragma omp parallel
    658 // expected-error@+1 {{expected expression}}
    659 #pragma omp parallel for simd lastprivate()
    660   for (i = 0; i < 16; ++i)
    661     ;
    662 #pragma omp parallel
    663 // expected-error@+1 {{expected expression}}
    664 #pragma omp parallel for simd lastprivate(int)
    665   for (i = 0; i < 16; ++i)
    666     ;
    667 #pragma omp parallel
    668 // expected-error@+1 {{expected variable name}}
    669 #pragma omp parallel for simd lastprivate(0)
    670   for (i = 0; i < 16; ++i)
    671     ;
    672 
    673   int x, y, z;
    674 #pragma omp parallel
    675 #pragma omp parallel for simd lastprivate(x)
    676   for (i = 0; i < 16; ++i)
    677     ;
    678 #pragma omp parallel
    679 #pragma omp parallel for simd lastprivate(x, y)
    680   for (i = 0; i < 16; ++i)
    681     ;
    682 #pragma omp parallel
    683 #pragma omp parallel for simd lastprivate(x, y, z)
    684   for (i = 0; i < 16; ++i)
    685     ;
    686 }
    687 
    688 void test_firstprivate() {
    689   int i;
    690 #pragma omp parallel
    691 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
    692 // expected-error@+1 {{expected expression}}
    693 #pragma omp parallel for simd firstprivate(
    694   for (i = 0; i < 16; ++i)
    695     ;
    696 
    697 #pragma omp parallel
    698 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
    699 // expected-error@+1 2 {{expected expression}}
    700 #pragma omp parallel for simd firstprivate(,
    701   for (i = 0; i < 16; ++i)
    702     ;
    703 #pragma omp parallel
    704 // expected-error@+1 2 {{expected expression}}
    705 #pragma omp parallel for simd firstprivate(, )
    706   for (i = 0; i < 16; ++i)
    707     ;
    708 #pragma omp parallel
    709 // expected-error@+1 {{expected expression}}
    710 #pragma omp parallel for simd firstprivate()
    711   for (i = 0; i < 16; ++i)
    712     ;
    713 #pragma omp parallel
    714 // expected-error@+1 {{expected expression}}
    715 #pragma omp parallel for simd firstprivate(int)
    716   for (i = 0; i < 16; ++i)
    717     ;
    718 #pragma omp parallel
    719 // expected-error@+1 {{expected variable name}}
    720 #pragma omp parallel for simd firstprivate(0)
    721   for (i = 0; i < 16; ++i)
    722     ;
    723 
    724   int x, y, z;
    725 #pragma omp parallel
    726 #pragma omp parallel for simd lastprivate(x) firstprivate(x)
    727   for (i = 0; i < 16; ++i)
    728     ;
    729 #pragma omp parallel
    730 #pragma omp parallel for simd lastprivate(x, y) firstprivate(x, y)
    731   for (i = 0; i < 16; ++i)
    732     ;
    733 #pragma omp parallel
    734 #pragma omp parallel for simd lastprivate(x, y, z) firstprivate(x, y, z)
    735   for (i = 0; i < 16; ++i)
    736     ;
    737 }
    738 
    739 void test_loop_messages() {
    740   float a[100], b[100], c[100];
    741 #pragma omp parallel
    742 // expected-error@+2 {{variable must be of integer or pointer type}}
    743 #pragma omp parallel for simd
    744   for (float fi = 0; fi < 10.0; fi++) {
    745     c[(int)fi] = a[(int)fi] + b[(int)fi];
    746   }
    747 #pragma omp parallel
    748 // expected-error@+2 {{variable must be of integer or pointer type}}
    749 #pragma omp parallel for simd
    750   for (double fi = 0; fi < 10.0; fi++) {
    751     c[(int)fi] = a[(int)fi] + b[(int)fi];
    752   }
    753 }
    754 
    755