Clang Project

clang_source_code/test/OpenMP/report_default_DSA.cpp
1// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s
2
3// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s
4
5void foo(int x, int n) {
6  double vec[n];
7  for (int iter = 0; iter < x; iter++) {
8#pragma omp target teams distribute parallel for map( \
9    from                                              \
10    : vec [0:n]) default(none)
11    // expected-error@+1 {{variable 'n' must have explicitly specified data sharing attributes}}
12    for (int ii = 0; ii < n; ii++) {
13      // expected-error@+3 {{variable 'iter' must have explicitly specified data sharing attributes}}
14      // expected-error@+2 {{variable 'vec' must have explicitly specified data sharing attributes}}
15      // expected-error@+1 {{variable 'x' must have explicitly specified data sharing attributes}}
16      vec[ii] = iter + ii + x;
17    }
18  }
19}
20
21