| 1 |
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized |
| 2 |
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized |
| 3 |
|
| 4 |
void foo(void) {} |
| 5 |
|
| 6 |
int main(int argc, char **argv) { |
| 7 |
int len = 8; |
| 8 |
double data[len]; |
| 9 |
|
| 10 |
// Valid strided array sections |
| 11 |
#pragma omp target update from(data[0:4:2]) // OK |
| 12 |
{} |
| 13 |
|
| 14 |
#pragma omp target update to(data[0:len/2:2]) // OK |
| 15 |
{} |
| 16 |
|
| 17 |
#pragma omp target update from(data[1:3:2]) // OK |
| 18 |
{} |
| 19 |
|
| 20 |
// Missing stride (default = 1) |
| 21 |
#pragma omp target update from(data[0:4]) // OK |
| 22 |
{} |
| 23 |
|
| 24 |
// Invalid stride expressions |
| 25 |
#pragma omp target update from(data[0:4:0]) // expected-error {{section stride is evaluated to a non-positive value 0}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 26 |
|
| 27 |
#pragma omp target update from(data[0:4:-1]) // expected-error {{section stride is evaluated to a non-positive value -1}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 28 |
|
| 29 |
// Missing colon |
| 30 |
#pragma omp target update from(data[0:4 2]) // expected-error {{expected ']'}} expected-note {{to match this '['}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 31 |
{} |
| 32 |
|
| 33 |
// Too many colons |
| 34 |
#pragma omp target update from(data[0:4:2:1]) // expected-error {{expected ']'}} expected-note {{to match this '['}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 35 |
{} |
| 36 |
|
| 37 |
return 0; |
| 38 |
} |