| 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 |
int main(int argc, char **argv) { |
| 5 |
int len = 16; |
| 6 |
double *data; |
| 7 |
|
| 8 |
// Valid strided array sections with TO |
| 9 |
#pragma omp target update to(data[0:8:2]) // OK - even indices |
| 10 |
{} |
| 11 |
|
| 12 |
#pragma omp target update to(data[1:4:3]) // OK - odd start with stride |
| 13 |
{} |
| 14 |
|
| 15 |
#pragma omp target update to(data[2:3:5]) // OK - large stride |
| 16 |
{} |
| 17 |
|
| 18 |
// Missing stride (default = 1) |
| 19 |
#pragma omp target update to(data[0:8]) // OK - default stride |
| 20 |
{} |
| 21 |
|
| 22 |
#pragma omp target update to(data[4:len-4]) // OK - computed length |
| 23 |
{} |
| 24 |
|
| 25 |
// Invalid stride expressions |
| 26 |
#pragma omp target update to(data[0:8: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'}} |
| 27 |
|
| 28 |
#pragma omp target update to(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'}} |
| 29 |
|
| 30 |
#pragma omp target update to(data[1:5:-2]) // expected-error {{section stride is evaluated to a non-positive value -2}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 31 |
|
| 32 |
// Syntax errors |
| 33 |
#pragma omp target update to(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'}} |
| 34 |
{} |
| 35 |
|
| 36 |
#pragma omp target update to(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'}} |
| 37 |
{} |
| 38 |
|
| 39 |
return 0; |
| 40 |
} |