brintos

brintos / llvm-project-archived public Read only

0
0
Text · 987 B · 6dc286c Raw
32 lines · c
1// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
2// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
3
4void foo(void) {}
5
6int main(int argc, char **argv) {
7  int len = 11;
8  double data[len];
9  
10  // Valid partial strided updates
11  #pragma omp target update from(data[0:4:3]) // OK
12  {}
13  
14  // Stride larger than length
15  #pragma omp target update from(data[0:2:10]) // OK
16  {}
17  
18  // Valid: complex expressions
19  int offset = 1;
20  int count = 3;
21  int stride = 2;
22  #pragma omp target update from(data[offset:count:stride]) // OK
23  {}
24  
25  // Invalid stride expressions
26  #pragma omp target update from(data[0:4:offset-1]) // OK if offset > 1
27  {}
28  
29  #pragma omp target update from(data[0:count: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'}}
30  
31  return 0;
32}