Debian Codegraph @

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