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 for simd'}}
      4 #pragma omp for simd
      5 
      6 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp for simd'}}
      7 #pragma omp for simd foo
      8 
      9 void test_no_clause() {
     10   int i;
     11 #pragma omp for simd
     12   for (i = 0; i < 16; ++i)
     13     ;
     14 
     15 // expected-error@+2 {{statement after '#pragma omp for simd' must be a for loop}}
     16 #pragma omp for simd
     17   ++i;
     18 }
     19 
     20 void test_branch_protected_scope() {
     21   int i = 0;
     22 L1:
     23   ++i;
     24 
     25   int x[24];
     26 
     27 #pragma omp parallel
     28 #pragma omp for simd
     29   for (i = 0; i < 16; ++i) {
     30     if (i == 5)
     31       goto L1; // expected-error {{use of undeclared label 'L1'}}
     32     else if (i == 6)
     33       return; // expected-error {{cannot return from OpenMP region}}
     34     else if (i == 7)
     35       goto L2;
     36     else if (i == 8) {
     37     L2:
     38       x[i]++;
     39     }
     40   }
     41 
     42   if (x[0] == 0)
     43     goto L2; // expected-error {{use of undeclared label 'L2'}}
     44   else if (x[1] == 1)
     45     goto L1;
     46 }
     47 
     48 void test_invalid_clause() {
     49   int i;
     50 #pragma omp parallel
     51 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
     52 #pragma omp for simd foo bar
     53   for (i = 0; i < 16; ++i)
     54     ;
     55 }
     56 
     57 void test_non_identifiers() {
     58   int i, x;
     59 
     60 #pragma omp parallel
     61 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
     62 #pragma omp for simd;
     63   for (i = 0; i < 16; ++i)
     64     ;
     65 #pragma omp parallel
     66 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
     67 #pragma omp for simd linear(x);
     68   for (i = 0; i < 16; ++i)
     69     ;
     70 
     71 #pragma omp parallel
     72 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
     73 #pragma omp for simd private(x);
     74   for (i = 0; i < 16; ++i)
     75     ;
     76 
     77 #pragma omp parallel
     78 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
     79 #pragma omp for simd, private(x);
     80   for (i = 0; i < 16; ++i)
     81     ;
     82 }
     83 
     84 extern int foo();
     85 void test_safelen() {
     86   int i;
     87 // expected-error@+1 {{expected '('}}
     88 #pragma omp for simd safelen
     89   for (i = 0; i < 16; ++i)
     90     ;
     91 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
     92 #pragma omp for simd safelen(
     93   for (i = 0; i < 16; ++i)
     94     ;
     95 // expected-error@+1 {{expected expression}}
     96 #pragma omp for simd safelen()
     97   for (i = 0; i < 16; ++i)
     98     ;
     99 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    100 #pragma omp for simd safelen(,
    101   for (i = 0; i < 16; ++i)
    102     ;
    103 // expected-error@+1 {{expected expression}}  expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    104 #pragma omp for simd safelen(, )
    105   for (i = 0; i < 16; ++i)
    106     ;
    107 // expected-warning@+2 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
    108 // expected-error@+1 {{expected '('}}
    109 #pragma omp for simd safelen 4)
    110   for (i = 0; i < 16; ++i)
    111     ;
    112 // expected-error@+2 {{expected ')'}}
    113 // expected-note@+1 {{to match this '('}}
    114 #pragma omp for simd safelen(4
    115   for (i = 0; i < 16; ++i)
    116     ;
    117 // expected-error@+2 {{expected ')'}}
    118 // expected-note@+1 {{to match this '('}}
    119 #pragma omp for simd safelen(4,
    120   for (i = 0; i < 16; ++i)
    121     ;
    122 // expected-error@+2 {{expected ')'}}
    123 // expected-note@+1 {{to match this '('}}
    124 #pragma omp for simd safelen(4, )
    125   for (i = 0; i < 16; ++i)
    126     ;
    127 #pragma omp for simd safelen(4)
    128   for (i = 0; i < 16; ++i)
    129     ;
    130 // expected-error@+2 {{expected ')'}}
    131 // expected-note@+1 {{to match this '('}}
    132 #pragma omp for simd safelen(4 4)
    133   for (i = 0; i < 16; ++i)
    134     ;
    135 // expected-error@+2 {{expected ')'}}
    136 // expected-note@+1 {{to match this '('}}
    137 #pragma omp for simd safelen(4, , 4)
    138   for (i = 0; i < 16; ++i)
    139     ;
    140 #pragma omp for simd safelen(4)
    141   for (i = 0; i < 16; ++i)
    142     ;
    143 // expected-error@+2 {{expected ')'}}
    144 // expected-note@+1 {{to match this '('}}
    145 #pragma omp for simd safelen(4, 8)
    146   for (i = 0; i < 16; ++i)
    147     ;
    148 // expected-error@+1 {{expression is not an integer constant expression}}
    149 #pragma omp for simd safelen(2.5)
    150   for (i = 0; i < 16; ++i)
    151     ;
    152 // expected-error@+1 {{expression is not an integer constant expression}}
    153 #pragma omp for simd safelen(foo())
    154   for (i = 0; i < 16; ++i)
    155     ;
    156 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
    157 #pragma omp for simd safelen(-5)
    158   for (i = 0; i < 16; ++i)
    159     ;
    160 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
    161 #pragma omp for simd safelen(0)
    162   for (i = 0; i < 16; ++i)
    163     ;
    164 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
    165 #pragma omp 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 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 for simd simdlen(
    178   for (i = 0; i < 16; ++i)
    179     ;
    180 // expected-error@+1 {{expected expression}}
    181 #pragma omp 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 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 for simd simdlen(, )
    190   for (i = 0; i < 16; ++i)
    191     ;
    192 // expected-warning@+2 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
    193 // expected-error@+1 {{expected '('}}
    194 #pragma omp 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 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 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 for simd simdlen(4, )
    210   for (i = 0; i < 16; ++i)
    211     ;
    212 #pragma omp 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 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 for simd simdlen(4, , 4)
    223   for (i = 0; i < 16; ++i)
    224     ;
    225 #pragma omp 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 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 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 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 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 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 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 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 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 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 for simd collapse(
    277   for (i = 0; i < 16; ++i)
    278     ;
    279 #pragma omp parallel
    280 // expected-error@+1 {{expected expression}}
    281 #pragma omp 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 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 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 for simd' are ignored}}
    296 // expected-error@+1 {{expected '('}}
    297 #pragma omp 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 for simd collapse(4
    304   for (i = 0; i < 16; ++i)
    305     ; // expected-error {{expected 4 for loops after '#pragma omp 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 for simd collapse(4,
    310   for (i = 0; i < 16; ++i)
    311     ; // expected-error {{expected 4 for loops after '#pragma omp 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 for simd collapse(4, )
    316   for (i = 0; i < 16; ++i)
    317     ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}}
    318 #pragma omp parallel
    319 // expected-note@+1 {{as specified in 'collapse' clause}}
    320 #pragma omp for simd collapse(4)
    321   for (i = 0; i < 16; ++i)
    322     ; // expected-error {{expected 4 for loops after '#pragma omp 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 for simd collapse(4 4)
    327   for (i = 0; i < 16; ++i)
    328     ; // expected-error {{expected 4 for loops after '#pragma omp 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 for simd collapse(4, , 4)
    333   for (i = 0; i < 16; ++i)
    334     ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}}
    335 #pragma omp parallel
    336 #pragma omp 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 for simd collapse(4, 8)
    346   for (i = 0; i < 16; ++i)
    347     ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}}
    348 #pragma omp parallel
    349 // expected-error@+1 {{expression is not an integer constant expression}}
    350 #pragma omp 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 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 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 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 for simd collapse(5 - 5)
    371   for (i = 0; i < 16; ++i)
    372     ;
    373 #pragma omp parallel
    374 #pragma omp for simd collapse(2)
    375   for (i = 0; i < 16; ++i)
    376 // expected-note@+1 {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for simd' directive into a parallel or another task region?}}
    377     for (int j = 0; j < 16; ++j)
    378 // expected-error@+2 {{reduction variable must be shared}}
    379 // expected-error@+1 {{OpenMP constructs may not be nested inside a simd region}}
    380 #pragma omp for simd reduction(+ : i, j)
    381       for (int k = 0; k < 16; ++k)
    382         i += j;
    383 }
    384 
    385 void test_linear() {
    386   int i;
    387 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    388 #pragma omp for simd linear(
    389   for (i = 0; i < 16; ++i)
    390     ;
    391 // expected-error@+2 {{expected expression}}
    392 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    393 #pragma omp for simd linear(,
    394   for (i = 0; i < 16; ++i)
    395     ;
    396 // expected-error@+2 {{expected expression}}
    397 // expected-error@+1 {{expected expression}}
    398 #pragma omp for simd linear(, )
    399   for (i = 0; i < 16; ++i)
    400     ;
    401 // expected-error@+1 {{expected expression}}
    402 #pragma omp for simd linear()
    403   for (i = 0; i < 16; ++i)
    404     ;
    405 // expected-error@+1 {{expected expression}}
    406 #pragma omp for simd linear(int)
    407   for (i = 0; i < 16; ++i)
    408     ;
    409 // expected-error@+1 {{expected variable name}}
    410 #pragma omp for simd linear(0)
    411   for (i = 0; i < 16; ++i)
    412     ;
    413 // expected-error@+1 {{use of undeclared identifier 'x'}}
    414 #pragma omp for simd linear(x)
    415   for (i = 0; i < 16; ++i)
    416     ;
    417 // expected-error@+2 {{use of undeclared identifier 'x'}}
    418 // expected-error@+1 {{use of undeclared identifier 'y'}}
    419 #pragma omp for simd linear(x, y)
    420   for (i = 0; i < 16; ++i)
    421     ;
    422 // expected-error@+3 {{use of undeclared identifier 'x'}}
    423 // expected-error@+2 {{use of undeclared identifier 'y'}}
    424 // expected-error@+1 {{use of undeclared identifier 'z'}}
    425 #pragma omp for simd linear(x, y, z)
    426   for (i = 0; i < 16; ++i)
    427     ;
    428 
    429   int x, y;
    430 // expected-error@+1 {{expected expression}}
    431 #pragma omp for simd linear(x :)
    432   for (i = 0; i < 16; ++i)
    433     ;
    434 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    435 #pragma omp for simd linear(x :, )
    436   for (i = 0; i < 16; ++i)
    437     ;
    438 #pragma omp for simd linear(x : 1)
    439   for (i = 0; i < 16; ++i)
    440     ;
    441 #pragma omp for simd linear(x : 2 * 2)
    442   for (i = 0; i < 16; ++i)
    443     ;
    444 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    445 #pragma omp for simd linear(x : 1, y)
    446   for (i = 0; i < 16; ++i)
    447     ;
    448 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    449 #pragma omp for simd linear(x : 1, y, z : 1)
    450   for (i = 0; i < 16; ++i)
    451     ;
    452 
    453 // expected-note@+2 {{defined as linear}}
    454 // expected-error@+1 {{linear variable cannot be linear}}
    455 #pragma omp for simd linear(x) linear(x)
    456   for (i = 0; i < 16; ++i)
    457     ;
    458 
    459 // expected-note@+2 {{defined as private}}
    460 // expected-error@+1 {{private variable cannot be linear}}
    461 #pragma omp for simd private(x) linear(x)
    462   for (i = 0; i < 16; ++i)
    463     ;
    464 
    465 // expected-note@+2 {{defined as linear}}
    466 // expected-error@+1 {{linear variable cannot be private}}
    467 #pragma omp for simd linear(x) private(x)
    468   for (i = 0; i < 16; ++i)
    469     ;
    470 
    471 // expected-warning@+1 {{zero linear step (x and other variables in clause should probably be const)}}
    472 #pragma omp for simd linear(x, y : 0)
    473   for (i = 0; i < 16; ++i)
    474     ;
    475 
    476 // expected-note@+2 {{defined as linear}}
    477 // expected-error@+1 {{linear variable cannot be lastprivate}}
    478 #pragma omp for simd linear(x) lastprivate(x)
    479   for (i = 0; i < 16; ++i)
    480     ;
    481 
    482 #pragma omp parallel
    483 // expected-note@+2 {{defined as lastprivate}}
    484 // expected-error@+1 {{lastprivate variable cannot be linear}}
    485 #pragma omp for simd lastprivate(x) linear(x)
    486   for (i = 0; i < 16; ++i)
    487     ;
    488 }
    489 
    490 void test_aligned() {
    491   int i;
    492 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    493 #pragma omp for simd aligned(
    494   for (i = 0; i < 16; ++i)
    495     ;
    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 for simd aligned(,
    499   for (i = 0; i < 16; ++i)
    500     ;
    501 // expected-error@+2 {{expected expression}}
    502 // expected-error@+1 {{expected expression}}
    503 #pragma omp for simd aligned(, )
    504   for (i = 0; i < 16; ++i)
    505     ;
    506 // expected-error@+1 {{expected expression}}
    507 #pragma omp for simd aligned()
    508   for (i = 0; i < 16; ++i)
    509     ;
    510 // expected-error@+1 {{expected expression}}
    511 #pragma omp for simd aligned(int)
    512   for (i = 0; i < 16; ++i)
    513     ;
    514 // expected-error@+1 {{expected variable name}}
    515 #pragma omp for simd aligned(0)
    516   for (i = 0; i < 16; ++i)
    517     ;
    518 // expected-error@+1 {{use of undeclared identifier 'x'}}
    519 #pragma omp for simd aligned(x)
    520   for (i = 0; i < 16; ++i)
    521     ;
    522 // expected-error@+2 {{use of undeclared identifier 'x'}}
    523 // expected-error@+1 {{use of undeclared identifier 'y'}}
    524 #pragma omp for simd aligned(x, y)
    525   for (i = 0; i < 16; ++i)
    526     ;
    527 // expected-error@+3 {{use of undeclared identifier 'x'}}
    528 // expected-error@+2 {{use of undeclared identifier 'y'}}
    529 // expected-error@+1 {{use of undeclared identifier 'z'}}
    530 #pragma omp for simd aligned(x, y, z)
    531   for (i = 0; i < 16; ++i)
    532     ;
    533 
    534   int *x, y, z[25]; // expected-note 4 {{'y' defined here}}
    535 #pragma omp for simd aligned(x)
    536   for (i = 0; i < 16; ++i)
    537     ;
    538 #pragma omp for simd aligned(z)
    539   for (i = 0; i < 16; ++i)
    540     ;
    541 // expected-error@+1 {{expected expression}}
    542 #pragma omp for simd aligned(x :)
    543   for (i = 0; i < 16; ++i)
    544     ;
    545 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    546 #pragma omp for simd aligned(x :, )
    547   for (i = 0; i < 16; ++i)
    548     ;
    549 #pragma omp for simd aligned(x : 1)
    550   for (i = 0; i < 16; ++i)
    551     ;
    552 #pragma omp for simd aligned(x : 2 * 2)
    553   for (i = 0; i < 16; ++i)
    554     ;
    555 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    556 #pragma omp for simd aligned(x : 1, y)
    557   for (i = 0; i < 16; ++i)
    558     ;
    559 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    560 #pragma omp for simd aligned(x : 1, y, z : 1)
    561   for (i = 0; i < 16; ++i)
    562     ;
    563 
    564 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
    565 #pragma omp for simd aligned(x, y)
    566   for (i = 0; i < 16; ++i)
    567     ;
    568 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
    569 #pragma omp for simd aligned(x, y, z)
    570   for (i = 0; i < 16; ++i)
    571     ;
    572 
    573 // expected-note@+2 {{defined as aligned}}
    574 // expected-error@+1 {{a variable cannot appear in more than one aligned clause}}
    575 #pragma omp for simd aligned(x) aligned(z, x)
    576   for (i = 0; i < 16; ++i)
    577     ;
    578 
    579 // expected-note@+3 {{defined as aligned}}
    580 // expected-error@+2 {{a variable cannot appear in more than one aligned clause}}
    581 // expected-error@+1 2 {{argument of aligned clause should be array or pointer, not 'int'}}
    582 #pragma omp for simd aligned(x, y, z) aligned(y, z)
    583   for (i = 0; i < 16; ++i)
    584     ;
    585 }
    586 
    587 
    588 void test_private() {
    589   int i;
    590 #pragma omp parallel
    591 // expected-error@+2 {{expected expression}}
    592 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
    593 #pragma omp for simd private(
    594   for (i = 0; i < 16; ++i)
    595     ;
    596 #pragma omp parallel
    597 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
    598 // expected-error@+1 2 {{expected expression}}
    599 #pragma omp for simd private(,
    600   for (i = 0; i < 16; ++i)
    601     ;
    602 #pragma omp parallel
    603 // expected-error@+1 2 {{expected expression}}
    604 #pragma omp for simd private(, )
    605   for (i = 0; i < 16; ++i)
    606     ;
    607 #pragma omp parallel
    608 // expected-error@+1 {{expected expression}}
    609 #pragma omp for simd private()
    610   for (i = 0; i < 16; ++i)
    611     ;
    612 #pragma omp parallel
    613 // expected-error@+1 {{expected expression}}
    614 #pragma omp for simd private(int)
    615   for (i = 0; i < 16; ++i)
    616     ;
    617 #pragma omp parallel
    618 // expected-error@+1 {{expected variable name}}
    619 #pragma omp for simd private(0)
    620   for (i = 0; i < 16; ++i)
    621     ;
    622 
    623   int x, y, z;
    624 #pragma omp parallel
    625 #pragma omp for simd private(x)
    626   for (i = 0; i < 16; ++i)
    627     ;
    628 #pragma omp parallel
    629 #pragma omp for simd private(x, y)
    630   for (i = 0; i < 16; ++i)
    631     ;
    632 #pragma omp parallel
    633 #pragma omp for simd private(x, y, z)
    634   for (i = 0; i < 16; ++i) {
    635     x = y * i + z;
    636   }
    637 }
    638 
    639 void test_lastprivate() {
    640   int i;
    641 #pragma omp parallel
    642 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
    643 // expected-error@+1 {{expected expression}}
    644 #pragma omp for simd lastprivate(
    645   for (i = 0; i < 16; ++i)
    646     ;
    647 
    648 #pragma omp parallel
    649 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
    650 // expected-error@+1 2 {{expected expression}}
    651 #pragma omp for simd lastprivate(,
    652   for (i = 0; i < 16; ++i)
    653     ;
    654 #pragma omp parallel
    655 // expected-error@+1 2 {{expected expression}}
    656 #pragma omp for simd lastprivate(, )
    657   for (i = 0; i < 16; ++i)
    658     ;
    659 #pragma omp parallel
    660 // expected-error@+1 {{expected expression}}
    661 #pragma omp for simd lastprivate()
    662   for (i = 0; i < 16; ++i)
    663     ;
    664 #pragma omp parallel
    665 // expected-error@+1 {{expected expression}}
    666 #pragma omp for simd lastprivate(int)
    667   for (i = 0; i < 16; ++i)
    668     ;
    669 #pragma omp parallel
    670 // expected-error@+1 {{expected variable name}}
    671 #pragma omp for simd lastprivate(0)
    672   for (i = 0; i < 16; ++i)
    673     ;
    674 
    675   int x, y, z;
    676 #pragma omp parallel
    677 #pragma omp for simd lastprivate(x)
    678   for (i = 0; i < 16; ++i)
    679     ;
    680 #pragma omp parallel
    681 #pragma omp for simd lastprivate(x, y)
    682   for (i = 0; i < 16; ++i)
    683     ;
    684 #pragma omp parallel
    685 #pragma omp for simd lastprivate(x, y, z)
    686   for (i = 0; i < 16; ++i)
    687     ;
    688 }
    689 
    690 void test_firstprivate() {
    691   int i;
    692 #pragma omp parallel
    693 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
    694 // expected-error@+1 {{expected expression}}
    695 #pragma omp for simd firstprivate(
    696   for (i = 0; i < 16; ++i)
    697     ;
    698 
    699 #pragma omp parallel
    700 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
    701 // expected-error@+1 2 {{expected expression}}
    702 #pragma omp for simd firstprivate(,
    703   for (i = 0; i < 16; ++i)
    704     ;
    705 #pragma omp parallel
    706 // expected-error@+1 2 {{expected expression}}
    707 #pragma omp for simd firstprivate(, )
    708   for (i = 0; i < 16; ++i)
    709     ;
    710 #pragma omp parallel
    711 // expected-error@+1 {{expected expression}}
    712 #pragma omp for simd firstprivate()
    713   for (i = 0; i < 16; ++i)
    714     ;
    715 #pragma omp parallel
    716 // expected-error@+1 {{expected expression}}
    717 #pragma omp for simd firstprivate(int)
    718   for (i = 0; i < 16; ++i)
    719     ;
    720 #pragma omp parallel
    721 // expected-error@+1 {{expected variable name}}
    722 #pragma omp for simd firstprivate(0)
    723   for (i = 0; i < 16; ++i)
    724     ;
    725 
    726   int x, y, z;
    727 #pragma omp parallel
    728 #pragma omp for simd lastprivate(x) firstprivate(x)
    729   for (i = 0; i < 16; ++i)
    730     ;
    731 #pragma omp parallel
    732 #pragma omp for simd lastprivate(x, y) firstprivate(x, y)
    733   for (i = 0; i < 16; ++i)
    734     ;
    735 #pragma omp parallel
    736 #pragma omp for simd lastprivate(x, y, z) firstprivate(x, y, z)
    737   for (i = 0; i < 16; ++i)
    738     ;
    739 }
    740 
    741 void test_loop_messages() {
    742   float a[100], b[100], c[100];
    743 #pragma omp parallel
    744 // expected-error@+2 {{variable must be of integer or pointer type}}
    745 #pragma omp for simd
    746   for (float fi = 0; fi < 10.0; fi++) {
    747     c[(int)fi] = a[(int)fi] + b[(int)fi];
    748   }
    749 #pragma omp parallel
    750 // expected-error@+2 {{variable must be of integer or pointer type}}
    751 #pragma omp for simd
    752   for (double fi = 0; fi < 10.0; fi++) {
    753     c[(int)fi] = a[(int)fi] + b[(int)fi];
    754   }
    755 }
    756 
    757