Debian Codegraph @

clang/test/OpenMP/target_update_strided_ptr_partial_messages_to.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 int main(int argc, char **argv) {
5 int len = 11;
6 double *data;
7
8 // Valid partial strided sections with TO
9 #pragma omp target update to(data[0:2:3]) // OK - partial coverage
10 {}
11
12 #pragma omp target update to(data[1:3:4]) // OK - offset with partial stride
13 {}
14
15 #pragma omp target update to(data[2:2:5]) // OK - large partial stride
16 {}
17
18 // Stride larger than remaining elements
19 #pragma omp target update to(data[0:2:10]) // OK - stride > array size
20 {}
21
22 #pragma omp target update to(data[0:3:len]) // OK - stride = len
23 {}
24
25 int offset = 1;
26 int stride = 2;
27
28 // Runtime-dependent invalid strides
29 #pragma omp target update to(data[0:4:offset-1]) // OK if offset > 1
30 {}
31
32 // Compile-time invalid strides
33 #pragma omp target update to(data[1:2:-3]) // expected-error {{section stride is evaluated to a non-positive value -3}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
34
35 return 0;
36 }