Debian Codegraph @

clang/test/OpenMP/target_update_strided_struct_messages_from.c

raw
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 #define N 8
5 typedef struct {
6 double data[N];
7 int len;
8 } T;
9
10 int main(int argc, char **argv) {
11 T s;
12 s.len = N;
13
14 // Valid strided array sections
15 #pragma omp target update from(s.data[0:4:2]) // OK
16 {}
17
18 #pragma omp target update from(s.data[1:3:2]) // OK
19 {}
20
21 // Missing stride (default = 1)
22 #pragma omp target update from(s.data[0:4]) // OK
23 {}
24
25 // Invalid stride expressions
26 #pragma omp target update from(s.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'}}
27
28 #pragma omp target update from(s.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 // Missing colon
31 #pragma omp target update from(s.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'}}
32 {}
33
34 // Too many colons
35 #pragma omp target update from(s.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'}}
36 {}
37
38 return 0;
39 }