]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/OpenMP/teams_distribute_parallel_for_simd_shared_messages.cpp
Vendor import of clang trunk r290819:
[FreeBSD/FreeBSD.git] / test / OpenMP / teams_distribute_parallel_for_simd_shared_messages.cpp
1 // RUN: %clang_cc1 -verify -fopenmp %s
2
3 void foo() {
4 }
5
6 bool foobool(int argc) {
7   return argc;
8 }
9
10 struct S1; // expected-note {{declared here}}
11 extern S1 a;
12 class S2 {
13   mutable int a;
14 public:
15   S2():a(0) { }
16   S2(S2 &s2):a(s2.a) { }
17 };
18 const S2 b;
19 const S2 ba[5];
20 class S3 {
21   int a;
22 public:
23   S3():a(0) { }
24   S3(S3 &s3):a(s3.a) { }
25 };
26 const S3 c;
27 const S3 ca[5];
28 extern const int f;
29 class S4 {
30   int a;
31   S4();
32   S4(const S4 &s4);
33 public:
34   S4(int v):a(v) { }
35 };
36 class S5 {
37   int a;
38   S5():a(0) {}
39   S5(const S5 &s5):a(s5.a) { }
40 public:
41   S5(int v):a(v) { }
42 };
43
44 S3 h;
45 #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
46
47 namespace A {
48 double x;
49 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
50 }
51 namespace B {
52 using A::x;
53 }
54
55 int main(int argc, char **argv) {
56   const int d = 5;
57   const int da[5] = { 0 };
58   S4 e(4);
59   S5 g(5);
60   int i;
61   int &j = i;
62   #pragma omp target
63   #pragma omp teams distribute parallel for simd shared // expected-error {{expected '(' after 'shared'}}
64   for (int j=0; j<100; j++) foo();
65   #pragma omp target
66   #pragma omp teams distribute parallel for simd shared ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
67   for (int j=0; j<100; j++) foo();
68   #pragma omp target
69   #pragma omp teams distribute parallel for simd shared () // expected-error {{expected expression}}
70   for (int j=0; j<100; j++) foo();
71   #pragma omp target
72   #pragma omp teams distribute parallel for simd shared (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
73   for (int j=0; j<100; j++) foo();
74   #pragma omp target
75   #pragma omp teams distribute parallel for simd shared (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
76   for (int j=0; j<100; j++) foo();
77   #pragma omp target
78   #pragma omp teams distribute parallel for simd shared (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
79   for (int j=0; j<100; j++) foo();
80   #pragma omp target
81   #pragma omp teams distribute parallel for simd shared (argc)
82   for (int j=0; j<100; j++) foo();
83   #pragma omp target
84   #pragma omp teams distribute parallel for simd shared (S1) // expected-error {{'S1' does not refer to a value}}
85   for (int j=0; j<100; j++) foo();
86   #pragma omp target
87   #pragma omp teams distribute parallel for simd shared (a, b, c, d, f)
88   for (int j=0; j<100; j++) foo();
89   #pragma omp target
90   #pragma omp teams distribute parallel for simd shared (argv[1]) // expected-error {{expected variable name}}
91   for (int j=0; j<100; j++) foo();
92   #pragma omp target
93   #pragma omp teams distribute parallel for simd shared(ba)
94   for (int j=0; j<100; j++) foo();
95   #pragma omp target
96   #pragma omp teams distribute parallel for simd shared(ca)
97   for (int j=0; j<100; j++) foo();
98   #pragma omp target
99   #pragma omp teams distribute parallel for simd shared(da)
100   for (int j=0; j<100; j++) foo();
101   #pragma omp target
102   #pragma omp teams distribute parallel for simd shared(e, g)
103   for (int j=0; j<100; j++) foo();
104   #pragma omp target
105   #pragma omp teams distribute parallel for simd shared(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be shared}}
106   for (int j=0; j<100; j++) foo();
107   #pragma omp target
108   #pragma omp teams distribute parallel for simd private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}}
109   for (int j=0; j<100; j++) foo();
110   #pragma omp target
111   #pragma omp teams distribute parallel for simd firstprivate(i), shared(i) // expected-error {{firstprivate variable cannot be shared}} expected-note {{defined as firstprivate}}
112   for (int j=0; j<100; j++) foo();
113   #pragma omp target
114   #pragma omp teams distribute parallel for simd private(i)
115   for (int j=0; j<100; j++) foo();
116   #pragma omp target
117   #pragma omp teams distribute parallel for simd shared(i)
118   for (int j=0; j<100; j++) foo();
119   #pragma omp target
120   #pragma omp teams distribute parallel for simd shared(j)
121   for (int j=0; j<100; j++) foo();
122   #pragma omp target
123   #pragma omp teams distribute parallel for simd firstprivate(i)
124   for (int j=0; j<100; j++) foo();
125
126   return 0;
127 }