aboutsummaryrefslogtreecommitdiff
path: root/clang/test/OpenMP/target_update_strided_partial_messages.c
blob: 6dc286c8a11611b2b0bb6aa6e8ed085859602ce7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized

void foo(void) {}

int main(int argc, char **argv) {
  int len = 11;
  double data[len];
  
  // Valid partial strided updates
  #pragma omp target update from(data[0:4:3]) // OK
  {}
  
  // Stride larger than length
  #pragma omp target update from(data[0:2:10]) // OK
  {}
  
  // Valid: complex expressions
  int offset = 1;
  int count = 3;
  int stride = 2;
  #pragma omp target update from(data[offset:count:stride]) // OK
  {}
  
  // Invalid stride expressions
  #pragma omp target update from(data[0:4:offset-1]) // OK if offset > 1
  {}
  
  #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'}}
  
  return 0;
}