xref: /minix3/external/bsd/llvm/dist/clang/test/OpenMP/nesting_of_regions.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -fopenmp=libiomp5 -verify %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc void bar();
4*0a6a1f1dSLionel Sambuc 
5*0a6a1f1dSLionel Sambuc template <class T>
foo()6*0a6a1f1dSLionel Sambuc void foo() {
7*0a6a1f1dSLionel Sambuc   T a = T();
8*0a6a1f1dSLionel Sambuc // PARALLEL DIRECTIVE
9*0a6a1f1dSLionel Sambuc #pragma omp parallel
10*0a6a1f1dSLionel Sambuc #pragma omp for
11*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
12*0a6a1f1dSLionel Sambuc     ;
13*0a6a1f1dSLionel Sambuc #pragma omp parallel
14*0a6a1f1dSLionel Sambuc #pragma omp simd
15*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
16*0a6a1f1dSLionel Sambuc     ;
17*0a6a1f1dSLionel Sambuc #pragma omp parallel
18*0a6a1f1dSLionel Sambuc #pragma omp for simd
19*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
20*0a6a1f1dSLionel Sambuc     ;
21*0a6a1f1dSLionel Sambuc #pragma omp parallel
22*0a6a1f1dSLionel Sambuc #pragma omp sections
23*0a6a1f1dSLionel Sambuc   {
24*0a6a1f1dSLionel Sambuc     bar();
25*0a6a1f1dSLionel Sambuc   }
26*0a6a1f1dSLionel Sambuc #pragma omp parallel
27*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel region}}
28*0a6a1f1dSLionel Sambuc   {
29*0a6a1f1dSLionel Sambuc     bar();
30*0a6a1f1dSLionel Sambuc   }
31*0a6a1f1dSLionel Sambuc #pragma omp parallel
32*0a6a1f1dSLionel Sambuc #pragma omp single
33*0a6a1f1dSLionel Sambuc   bar();
34*0a6a1f1dSLionel Sambuc 
35*0a6a1f1dSLionel Sambuc #pragma omp parallel
36*0a6a1f1dSLionel Sambuc #pragma omp master
37*0a6a1f1dSLionel Sambuc   {
38*0a6a1f1dSLionel Sambuc     bar();
39*0a6a1f1dSLionel Sambuc   }
40*0a6a1f1dSLionel Sambuc #pragma omp parallel
41*0a6a1f1dSLionel Sambuc #pragma omp critical
42*0a6a1f1dSLionel Sambuc   {
43*0a6a1f1dSLionel Sambuc     bar();
44*0a6a1f1dSLionel Sambuc   }
45*0a6a1f1dSLionel Sambuc #pragma omp parallel
46*0a6a1f1dSLionel Sambuc #pragma omp parallel for
47*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
48*0a6a1f1dSLionel Sambuc     ;
49*0a6a1f1dSLionel Sambuc #pragma omp parallel
50*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
51*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
52*0a6a1f1dSLionel Sambuc     ;
53*0a6a1f1dSLionel Sambuc #pragma omp parallel
54*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
55*0a6a1f1dSLionel Sambuc   {
56*0a6a1f1dSLionel Sambuc     bar();
57*0a6a1f1dSLionel Sambuc   }
58*0a6a1f1dSLionel Sambuc #pragma omp parallel
59*0a6a1f1dSLionel Sambuc #pragma omp task
60*0a6a1f1dSLionel Sambuc   {
61*0a6a1f1dSLionel Sambuc     bar();
62*0a6a1f1dSLionel Sambuc   }
63*0a6a1f1dSLionel Sambuc #pragma omp parallel
64*0a6a1f1dSLionel Sambuc   {
65*0a6a1f1dSLionel Sambuc #pragma omp taskyield
66*0a6a1f1dSLionel Sambuc     bar();
67*0a6a1f1dSLionel Sambuc   }
68*0a6a1f1dSLionel Sambuc #pragma omp parallel
69*0a6a1f1dSLionel Sambuc   {
70*0a6a1f1dSLionel Sambuc #pragma omp barrier
71*0a6a1f1dSLionel Sambuc     bar();
72*0a6a1f1dSLionel Sambuc   }
73*0a6a1f1dSLionel Sambuc #pragma omp parallel
74*0a6a1f1dSLionel Sambuc   {
75*0a6a1f1dSLionel Sambuc #pragma omp taskwait
76*0a6a1f1dSLionel Sambuc     bar();
77*0a6a1f1dSLionel Sambuc   }
78*0a6a1f1dSLionel Sambuc #pragma omp parallel
79*0a6a1f1dSLionel Sambuc   {
80*0a6a1f1dSLionel Sambuc #pragma omp flush
81*0a6a1f1dSLionel Sambuc     bar();
82*0a6a1f1dSLionel Sambuc   }
83*0a6a1f1dSLionel Sambuc #pragma omp parallel
84*0a6a1f1dSLionel Sambuc   {
85*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
86*0a6a1f1dSLionel Sambuc     bar();
87*0a6a1f1dSLionel Sambuc   }
88*0a6a1f1dSLionel Sambuc #pragma omp parallel
89*0a6a1f1dSLionel Sambuc   {
90*0a6a1f1dSLionel Sambuc #pragma omp atomic
91*0a6a1f1dSLionel Sambuc     ++a;
92*0a6a1f1dSLionel Sambuc   }
93*0a6a1f1dSLionel Sambuc #pragma omp parallel
94*0a6a1f1dSLionel Sambuc   {
95*0a6a1f1dSLionel Sambuc #pragma omp target
96*0a6a1f1dSLionel Sambuc     ++a;
97*0a6a1f1dSLionel Sambuc   }
98*0a6a1f1dSLionel Sambuc #pragma omp parallel
99*0a6a1f1dSLionel Sambuc   {
100*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
101*0a6a1f1dSLionel Sambuc     ++a;
102*0a6a1f1dSLionel Sambuc   }
103*0a6a1f1dSLionel Sambuc 
104*0a6a1f1dSLionel Sambuc // SIMD DIRECTIVE
105*0a6a1f1dSLionel Sambuc #pragma omp simd
106*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
107*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
108*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
109*0a6a1f1dSLionel Sambuc       ;
110*0a6a1f1dSLionel Sambuc   }
111*0a6a1f1dSLionel Sambuc #pragma omp simd
112*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
113*0a6a1f1dSLionel Sambuc #pragma omp simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
114*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
115*0a6a1f1dSLionel Sambuc       ;
116*0a6a1f1dSLionel Sambuc   }
117*0a6a1f1dSLionel Sambuc #pragma omp simd
118*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
119*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
120*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
121*0a6a1f1dSLionel Sambuc       ;
122*0a6a1f1dSLionel Sambuc   }
123*0a6a1f1dSLionel Sambuc #pragma omp simd
124*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
125*0a6a1f1dSLionel Sambuc #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
126*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
127*0a6a1f1dSLionel Sambuc       ;
128*0a6a1f1dSLionel Sambuc   }
129*0a6a1f1dSLionel Sambuc #pragma omp simd
130*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
131*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
132*0a6a1f1dSLionel Sambuc     {
133*0a6a1f1dSLionel Sambuc       bar();
134*0a6a1f1dSLionel Sambuc     }
135*0a6a1f1dSLionel Sambuc   }
136*0a6a1f1dSLionel Sambuc #pragma omp simd
137*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
138*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
139*0a6a1f1dSLionel Sambuc     {
140*0a6a1f1dSLionel Sambuc       bar();
141*0a6a1f1dSLionel Sambuc     }
142*0a6a1f1dSLionel Sambuc   }
143*0a6a1f1dSLionel Sambuc #pragma omp simd
144*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
145*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
146*0a6a1f1dSLionel Sambuc     {
147*0a6a1f1dSLionel Sambuc       bar();
148*0a6a1f1dSLionel Sambuc     }
149*0a6a1f1dSLionel Sambuc   }
150*0a6a1f1dSLionel Sambuc #pragma omp simd
151*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
152*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
153*0a6a1f1dSLionel Sambuc     {
154*0a6a1f1dSLionel Sambuc       bar();
155*0a6a1f1dSLionel Sambuc     }
156*0a6a1f1dSLionel Sambuc   }
157*0a6a1f1dSLionel Sambuc #pragma omp simd
158*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
159*0a6a1f1dSLionel Sambuc #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
160*0a6a1f1dSLionel Sambuc     {
161*0a6a1f1dSLionel Sambuc       bar();
162*0a6a1f1dSLionel Sambuc     }
163*0a6a1f1dSLionel Sambuc   }
164*0a6a1f1dSLionel Sambuc #pragma omp simd
165*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
166*0a6a1f1dSLionel Sambuc #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
167*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
168*0a6a1f1dSLionel Sambuc       ;
169*0a6a1f1dSLionel Sambuc   }
170*0a6a1f1dSLionel Sambuc #pragma omp simd
171*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
172*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
173*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
174*0a6a1f1dSLionel Sambuc       ;
175*0a6a1f1dSLionel Sambuc   }
176*0a6a1f1dSLionel Sambuc #pragma omp simd
177*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
178*0a6a1f1dSLionel Sambuc #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
179*0a6a1f1dSLionel Sambuc     {
180*0a6a1f1dSLionel Sambuc       bar();
181*0a6a1f1dSLionel Sambuc     }
182*0a6a1f1dSLionel Sambuc   }
183*0a6a1f1dSLionel Sambuc #pragma omp simd
184*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
185*0a6a1f1dSLionel Sambuc #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
186*0a6a1f1dSLionel Sambuc     {
187*0a6a1f1dSLionel Sambuc       bar();
188*0a6a1f1dSLionel Sambuc     }
189*0a6a1f1dSLionel Sambuc   }
190*0a6a1f1dSLionel Sambuc #pragma omp simd
191*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
192*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
193*0a6a1f1dSLionel Sambuc     bar();
194*0a6a1f1dSLionel Sambuc   }
195*0a6a1f1dSLionel Sambuc #pragma omp simd
196*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
197*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
198*0a6a1f1dSLionel Sambuc     bar();
199*0a6a1f1dSLionel Sambuc   }
200*0a6a1f1dSLionel Sambuc #pragma omp simd
201*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
202*0a6a1f1dSLionel Sambuc #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
203*0a6a1f1dSLionel Sambuc     bar();
204*0a6a1f1dSLionel Sambuc   }
205*0a6a1f1dSLionel Sambuc #pragma omp simd
206*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
207*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
208*0a6a1f1dSLionel Sambuc     bar();
209*0a6a1f1dSLionel Sambuc   }
210*0a6a1f1dSLionel Sambuc #pragma omp simd
211*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
212*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
213*0a6a1f1dSLionel Sambuc     bar();
214*0a6a1f1dSLionel Sambuc   }
215*0a6a1f1dSLionel Sambuc #pragma omp simd
216*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
217*0a6a1f1dSLionel Sambuc #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
218*0a6a1f1dSLionel Sambuc     ++a;
219*0a6a1f1dSLionel Sambuc   }
220*0a6a1f1dSLionel Sambuc #pragma omp simd
221*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
222*0a6a1f1dSLionel Sambuc #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
223*0a6a1f1dSLionel Sambuc     ++a;
224*0a6a1f1dSLionel Sambuc   }
225*0a6a1f1dSLionel Sambuc #pragma omp simd
226*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
227*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
228*0a6a1f1dSLionel Sambuc     ++a;
229*0a6a1f1dSLionel Sambuc   }
230*0a6a1f1dSLionel Sambuc 
231*0a6a1f1dSLionel Sambuc // FOR DIRECTIVE
232*0a6a1f1dSLionel Sambuc #pragma omp for
233*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
234*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
235*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
236*0a6a1f1dSLionel Sambuc       ;
237*0a6a1f1dSLionel Sambuc   }
238*0a6a1f1dSLionel Sambuc #pragma omp for
239*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
240*0a6a1f1dSLionel Sambuc #pragma omp simd
241*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
242*0a6a1f1dSLionel Sambuc       ;
243*0a6a1f1dSLionel Sambuc   }
244*0a6a1f1dSLionel Sambuc #pragma omp for
245*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
246*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
247*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
248*0a6a1f1dSLionel Sambuc       ;
249*0a6a1f1dSLionel Sambuc   }
250*0a6a1f1dSLionel Sambuc #pragma omp for
251*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
252*0a6a1f1dSLionel Sambuc #pragma omp parallel
253*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
254*0a6a1f1dSLionel Sambuc       ;
255*0a6a1f1dSLionel Sambuc   }
256*0a6a1f1dSLionel Sambuc #pragma omp for
257*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
258*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
259*0a6a1f1dSLionel Sambuc     {
260*0a6a1f1dSLionel Sambuc       bar();
261*0a6a1f1dSLionel Sambuc     }
262*0a6a1f1dSLionel Sambuc   }
263*0a6a1f1dSLionel Sambuc #pragma omp for
264*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
265*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a for region}}
266*0a6a1f1dSLionel Sambuc     {
267*0a6a1f1dSLionel Sambuc       bar();
268*0a6a1f1dSLionel Sambuc     }
269*0a6a1f1dSLionel Sambuc   }
270*0a6a1f1dSLionel Sambuc #pragma omp for
271*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
272*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
273*0a6a1f1dSLionel Sambuc     {
274*0a6a1f1dSLionel Sambuc       bar();
275*0a6a1f1dSLionel Sambuc     }
276*0a6a1f1dSLionel Sambuc   }
277*0a6a1f1dSLionel Sambuc 
278*0a6a1f1dSLionel Sambuc #pragma omp for
279*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
280*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'for' region}}
281*0a6a1f1dSLionel Sambuc     {
282*0a6a1f1dSLionel Sambuc       bar();
283*0a6a1f1dSLionel Sambuc     }
284*0a6a1f1dSLionel Sambuc   }
285*0a6a1f1dSLionel Sambuc #pragma omp for
286*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
287*0a6a1f1dSLionel Sambuc #pragma omp critical
288*0a6a1f1dSLionel Sambuc     {
289*0a6a1f1dSLionel Sambuc       bar();
290*0a6a1f1dSLionel Sambuc     }
291*0a6a1f1dSLionel Sambuc   }
292*0a6a1f1dSLionel Sambuc #pragma omp for
293*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
294*0a6a1f1dSLionel Sambuc #pragma omp parallel
295*0a6a1f1dSLionel Sambuc     {
296*0a6a1f1dSLionel Sambuc #pragma omp single // OK
297*0a6a1f1dSLionel Sambuc       {
298*0a6a1f1dSLionel Sambuc         bar();
299*0a6a1f1dSLionel Sambuc       }
300*0a6a1f1dSLionel Sambuc #pragma omp for // OK
301*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
302*0a6a1f1dSLionel Sambuc         ;
303*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
304*0a6a1f1dSLionel Sambuc       {
305*0a6a1f1dSLionel Sambuc         bar();
306*0a6a1f1dSLionel Sambuc       }
307*0a6a1f1dSLionel Sambuc     }
308*0a6a1f1dSLionel Sambuc   }
309*0a6a1f1dSLionel Sambuc #pragma omp for
310*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
311*0a6a1f1dSLionel Sambuc #pragma omp parallel for
312*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
313*0a6a1f1dSLionel Sambuc       ;
314*0a6a1f1dSLionel Sambuc   }
315*0a6a1f1dSLionel Sambuc #pragma omp for
316*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
317*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
318*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
319*0a6a1f1dSLionel Sambuc       ;
320*0a6a1f1dSLionel Sambuc   }
321*0a6a1f1dSLionel Sambuc #pragma omp for
322*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
323*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
324*0a6a1f1dSLionel Sambuc     {
325*0a6a1f1dSLionel Sambuc       bar();
326*0a6a1f1dSLionel Sambuc     }
327*0a6a1f1dSLionel Sambuc   }
328*0a6a1f1dSLionel Sambuc #pragma omp for
329*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
330*0a6a1f1dSLionel Sambuc #pragma omp task
331*0a6a1f1dSLionel Sambuc     {
332*0a6a1f1dSLionel Sambuc       bar();
333*0a6a1f1dSLionel Sambuc     }
334*0a6a1f1dSLionel Sambuc   }
335*0a6a1f1dSLionel Sambuc #pragma omp for
336*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
337*0a6a1f1dSLionel Sambuc #pragma omp taskyield
338*0a6a1f1dSLionel Sambuc     bar();
339*0a6a1f1dSLionel Sambuc   }
340*0a6a1f1dSLionel Sambuc #pragma omp for
341*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
342*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'for' region}}
343*0a6a1f1dSLionel Sambuc     bar();
344*0a6a1f1dSLionel Sambuc   }
345*0a6a1f1dSLionel Sambuc #pragma omp for
346*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
347*0a6a1f1dSLionel Sambuc #pragma omp taskwait
348*0a6a1f1dSLionel Sambuc     bar();
349*0a6a1f1dSLionel Sambuc   }
350*0a6a1f1dSLionel Sambuc #pragma omp for
351*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
352*0a6a1f1dSLionel Sambuc #pragma omp flush
353*0a6a1f1dSLionel Sambuc     bar();
354*0a6a1f1dSLionel Sambuc   }
355*0a6a1f1dSLionel Sambuc #pragma omp for
356*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
357*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
358*0a6a1f1dSLionel Sambuc     bar();
359*0a6a1f1dSLionel Sambuc   }
360*0a6a1f1dSLionel Sambuc #pragma omp for ordered
361*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
362*0a6a1f1dSLionel Sambuc #pragma omp ordered // OK
363*0a6a1f1dSLionel Sambuc     bar();
364*0a6a1f1dSLionel Sambuc   }
365*0a6a1f1dSLionel Sambuc #pragma omp for
366*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
367*0a6a1f1dSLionel Sambuc #pragma omp atomic
368*0a6a1f1dSLionel Sambuc     ++a;
369*0a6a1f1dSLionel Sambuc   }
370*0a6a1f1dSLionel Sambuc #pragma omp for
371*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
372*0a6a1f1dSLionel Sambuc #pragma omp target
373*0a6a1f1dSLionel Sambuc     ++a;
374*0a6a1f1dSLionel Sambuc   }
375*0a6a1f1dSLionel Sambuc #pragma omp for
376*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
377*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
378*0a6a1f1dSLionel Sambuc     ++a;
379*0a6a1f1dSLionel Sambuc   }
380*0a6a1f1dSLionel Sambuc 
381*0a6a1f1dSLionel Sambuc // FOR SIMD DIRECTIVE
382*0a6a1f1dSLionel Sambuc #pragma omp for simd
383*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
384*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
385*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
386*0a6a1f1dSLionel Sambuc       ;
387*0a6a1f1dSLionel Sambuc   }
388*0a6a1f1dSLionel Sambuc #pragma omp for simd
389*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
390*0a6a1f1dSLionel Sambuc #pragma omp simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
391*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
392*0a6a1f1dSLionel Sambuc       ;
393*0a6a1f1dSLionel Sambuc   }
394*0a6a1f1dSLionel Sambuc #pragma omp for simd
395*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
396*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
397*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
398*0a6a1f1dSLionel Sambuc       ;
399*0a6a1f1dSLionel Sambuc   }
400*0a6a1f1dSLionel Sambuc #pragma omp for simd
401*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
402*0a6a1f1dSLionel Sambuc #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
403*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
404*0a6a1f1dSLionel Sambuc       ;
405*0a6a1f1dSLionel Sambuc   }
406*0a6a1f1dSLionel Sambuc #pragma omp for simd
407*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
408*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
409*0a6a1f1dSLionel Sambuc     {
410*0a6a1f1dSLionel Sambuc       bar();
411*0a6a1f1dSLionel Sambuc     }
412*0a6a1f1dSLionel Sambuc   }
413*0a6a1f1dSLionel Sambuc #pragma omp for simd
414*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
415*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
416*0a6a1f1dSLionel Sambuc     {
417*0a6a1f1dSLionel Sambuc       bar();
418*0a6a1f1dSLionel Sambuc     }
419*0a6a1f1dSLionel Sambuc   }
420*0a6a1f1dSLionel Sambuc #pragma omp for simd
421*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
422*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
423*0a6a1f1dSLionel Sambuc     {
424*0a6a1f1dSLionel Sambuc       bar();
425*0a6a1f1dSLionel Sambuc     }
426*0a6a1f1dSLionel Sambuc   }
427*0a6a1f1dSLionel Sambuc #pragma omp for simd
428*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
429*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
430*0a6a1f1dSLionel Sambuc     {
431*0a6a1f1dSLionel Sambuc       bar();
432*0a6a1f1dSLionel Sambuc     }
433*0a6a1f1dSLionel Sambuc   }
434*0a6a1f1dSLionel Sambuc #pragma omp for simd
435*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
436*0a6a1f1dSLionel Sambuc #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
437*0a6a1f1dSLionel Sambuc     {
438*0a6a1f1dSLionel Sambuc       bar();
439*0a6a1f1dSLionel Sambuc     }
440*0a6a1f1dSLionel Sambuc   }
441*0a6a1f1dSLionel Sambuc #pragma omp for simd
442*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
443*0a6a1f1dSLionel Sambuc #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
444*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
445*0a6a1f1dSLionel Sambuc       ;
446*0a6a1f1dSLionel Sambuc   }
447*0a6a1f1dSLionel Sambuc #pragma omp for simd
448*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
449*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
450*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
451*0a6a1f1dSLionel Sambuc       ;
452*0a6a1f1dSLionel Sambuc   }
453*0a6a1f1dSLionel Sambuc #pragma omp for simd
454*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
455*0a6a1f1dSLionel Sambuc #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
456*0a6a1f1dSLionel Sambuc     {
457*0a6a1f1dSLionel Sambuc       bar();
458*0a6a1f1dSLionel Sambuc     }
459*0a6a1f1dSLionel Sambuc   }
460*0a6a1f1dSLionel Sambuc #pragma omp for simd
461*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
462*0a6a1f1dSLionel Sambuc #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
463*0a6a1f1dSLionel Sambuc     {
464*0a6a1f1dSLionel Sambuc       bar();
465*0a6a1f1dSLionel Sambuc     }
466*0a6a1f1dSLionel Sambuc   }
467*0a6a1f1dSLionel Sambuc #pragma omp for simd
468*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
469*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
470*0a6a1f1dSLionel Sambuc     bar();
471*0a6a1f1dSLionel Sambuc   }
472*0a6a1f1dSLionel Sambuc #pragma omp for simd
473*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
474*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
475*0a6a1f1dSLionel Sambuc     bar();
476*0a6a1f1dSLionel Sambuc   }
477*0a6a1f1dSLionel Sambuc #pragma omp for simd
478*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
479*0a6a1f1dSLionel Sambuc #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
480*0a6a1f1dSLionel Sambuc     bar();
481*0a6a1f1dSLionel Sambuc   }
482*0a6a1f1dSLionel Sambuc #pragma omp for simd
483*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
484*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
485*0a6a1f1dSLionel Sambuc     bar();
486*0a6a1f1dSLionel Sambuc   }
487*0a6a1f1dSLionel Sambuc #pragma omp for simd
488*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
489*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
490*0a6a1f1dSLionel Sambuc     bar();
491*0a6a1f1dSLionel Sambuc   }
492*0a6a1f1dSLionel Sambuc #pragma omp for simd
493*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
494*0a6a1f1dSLionel Sambuc #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
495*0a6a1f1dSLionel Sambuc     ++a;
496*0a6a1f1dSLionel Sambuc   }
497*0a6a1f1dSLionel Sambuc #pragma omp for simd
498*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
499*0a6a1f1dSLionel Sambuc #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
500*0a6a1f1dSLionel Sambuc     ++a;
501*0a6a1f1dSLionel Sambuc   }
502*0a6a1f1dSLionel Sambuc #pragma omp for simd
503*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
504*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
505*0a6a1f1dSLionel Sambuc     ++a;
506*0a6a1f1dSLionel Sambuc   }
507*0a6a1f1dSLionel Sambuc 
508*0a6a1f1dSLionel Sambuc // SECTIONS DIRECTIVE
509*0a6a1f1dSLionel Sambuc #pragma omp sections
510*0a6a1f1dSLionel Sambuc   {
511*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
512*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
513*0a6a1f1dSLionel Sambuc       ;
514*0a6a1f1dSLionel Sambuc   }
515*0a6a1f1dSLionel Sambuc #pragma omp sections
516*0a6a1f1dSLionel Sambuc   {
517*0a6a1f1dSLionel Sambuc #pragma omp simd
518*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
519*0a6a1f1dSLionel Sambuc       ;
520*0a6a1f1dSLionel Sambuc   }
521*0a6a1f1dSLionel Sambuc #pragma omp sections
522*0a6a1f1dSLionel Sambuc   {
523*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
524*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
525*0a6a1f1dSLionel Sambuc       ;
526*0a6a1f1dSLionel Sambuc   }
527*0a6a1f1dSLionel Sambuc #pragma omp sections
528*0a6a1f1dSLionel Sambuc   {
529*0a6a1f1dSLionel Sambuc #pragma omp parallel
530*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
531*0a6a1f1dSLionel Sambuc       ;
532*0a6a1f1dSLionel Sambuc   }
533*0a6a1f1dSLionel Sambuc #pragma omp sections
534*0a6a1f1dSLionel Sambuc   {
535*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
536*0a6a1f1dSLionel Sambuc     {
537*0a6a1f1dSLionel Sambuc       bar();
538*0a6a1f1dSLionel Sambuc     }
539*0a6a1f1dSLionel Sambuc   }
540*0a6a1f1dSLionel Sambuc #pragma omp sections
541*0a6a1f1dSLionel Sambuc   {
542*0a6a1f1dSLionel Sambuc #pragma omp section
543*0a6a1f1dSLionel Sambuc     {
544*0a6a1f1dSLionel Sambuc       bar();
545*0a6a1f1dSLionel Sambuc     }
546*0a6a1f1dSLionel Sambuc   }
547*0a6a1f1dSLionel Sambuc #pragma omp sections
548*0a6a1f1dSLionel Sambuc   {
549*0a6a1f1dSLionel Sambuc #pragma omp parallel
550*0a6a1f1dSLionel Sambuc     {
551*0a6a1f1dSLionel Sambuc #pragma omp single // OK
552*0a6a1f1dSLionel Sambuc       {
553*0a6a1f1dSLionel Sambuc         bar();
554*0a6a1f1dSLionel Sambuc       }
555*0a6a1f1dSLionel Sambuc #pragma omp for // OK
556*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
557*0a6a1f1dSLionel Sambuc         ;
558*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
559*0a6a1f1dSLionel Sambuc       {
560*0a6a1f1dSLionel Sambuc         bar();
561*0a6a1f1dSLionel Sambuc       }
562*0a6a1f1dSLionel Sambuc     }
563*0a6a1f1dSLionel Sambuc   }
564*0a6a1f1dSLionel Sambuc #pragma omp sections
565*0a6a1f1dSLionel Sambuc   {
566*0a6a1f1dSLionel Sambuc #pragma omp parallel
567*0a6a1f1dSLionel Sambuc     {
568*0a6a1f1dSLionel Sambuc #pragma omp master // OK
569*0a6a1f1dSLionel Sambuc       {
570*0a6a1f1dSLionel Sambuc         bar();
571*0a6a1f1dSLionel Sambuc       }
572*0a6a1f1dSLionel Sambuc #pragma omp for // OK
573*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
574*0a6a1f1dSLionel Sambuc         ;
575*0a6a1f1dSLionel Sambuc #pragma omp master // OK
576*0a6a1f1dSLionel Sambuc       {
577*0a6a1f1dSLionel Sambuc         bar();
578*0a6a1f1dSLionel Sambuc       }
579*0a6a1f1dSLionel Sambuc     }
580*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'sections' region}}
581*0a6a1f1dSLionel Sambuc     bar();
582*0a6a1f1dSLionel Sambuc   }
583*0a6a1f1dSLionel Sambuc #pragma omp sections
584*0a6a1f1dSLionel Sambuc   {
585*0a6a1f1dSLionel Sambuc #pragma omp parallel
586*0a6a1f1dSLionel Sambuc     {
587*0a6a1f1dSLionel Sambuc #pragma omp critical(A) // OK
588*0a6a1f1dSLionel Sambuc       {
589*0a6a1f1dSLionel Sambuc         bar();
590*0a6a1f1dSLionel Sambuc       }
591*0a6a1f1dSLionel Sambuc #pragma omp for // OK
592*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
593*0a6a1f1dSLionel Sambuc         ;
594*0a6a1f1dSLionel Sambuc #pragma omp critical // OK
595*0a6a1f1dSLionel Sambuc       {
596*0a6a1f1dSLionel Sambuc         bar();
597*0a6a1f1dSLionel Sambuc       }
598*0a6a1f1dSLionel Sambuc     }
599*0a6a1f1dSLionel Sambuc #pragma omp critical(A) // expected-error {{statement in 'omp sections' directive must be enclosed into a section region}}
600*0a6a1f1dSLionel Sambuc     bar();
601*0a6a1f1dSLionel Sambuc   }
602*0a6a1f1dSLionel Sambuc #pragma omp sections
603*0a6a1f1dSLionel Sambuc   {
604*0a6a1f1dSLionel Sambuc #pragma omp parallel for
605*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
606*0a6a1f1dSLionel Sambuc       ;
607*0a6a1f1dSLionel Sambuc   }
608*0a6a1f1dSLionel Sambuc #pragma omp sections
609*0a6a1f1dSLionel Sambuc   {
610*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
611*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
612*0a6a1f1dSLionel Sambuc       ;
613*0a6a1f1dSLionel Sambuc   }
614*0a6a1f1dSLionel Sambuc #pragma omp sections
615*0a6a1f1dSLionel Sambuc   {
616*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
617*0a6a1f1dSLionel Sambuc     {
618*0a6a1f1dSLionel Sambuc       bar();
619*0a6a1f1dSLionel Sambuc     }
620*0a6a1f1dSLionel Sambuc   }
621*0a6a1f1dSLionel Sambuc #pragma omp sections
622*0a6a1f1dSLionel Sambuc   {
623*0a6a1f1dSLionel Sambuc #pragma omp task
624*0a6a1f1dSLionel Sambuc     {
625*0a6a1f1dSLionel Sambuc       bar();
626*0a6a1f1dSLionel Sambuc     }
627*0a6a1f1dSLionel Sambuc   }
628*0a6a1f1dSLionel Sambuc #pragma omp sections
629*0a6a1f1dSLionel Sambuc   {
630*0a6a1f1dSLionel Sambuc #pragma omp taskyield
631*0a6a1f1dSLionel Sambuc   }
632*0a6a1f1dSLionel Sambuc #pragma omp sections
633*0a6a1f1dSLionel Sambuc   {
634*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'sections' region}}
635*0a6a1f1dSLionel Sambuc   }
636*0a6a1f1dSLionel Sambuc #pragma omp sections
637*0a6a1f1dSLionel Sambuc   {
638*0a6a1f1dSLionel Sambuc #pragma omp taskwait
639*0a6a1f1dSLionel Sambuc   }
640*0a6a1f1dSLionel Sambuc #pragma omp sections
641*0a6a1f1dSLionel Sambuc   {
642*0a6a1f1dSLionel Sambuc #pragma omp flush
643*0a6a1f1dSLionel Sambuc   }
644*0a6a1f1dSLionel Sambuc #pragma omp sections
645*0a6a1f1dSLionel Sambuc   {
646*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
647*0a6a1f1dSLionel Sambuc     bar();
648*0a6a1f1dSLionel Sambuc   }
649*0a6a1f1dSLionel Sambuc #pragma omp sections
650*0a6a1f1dSLionel Sambuc   {
651*0a6a1f1dSLionel Sambuc #pragma omp atomic
652*0a6a1f1dSLionel Sambuc     ++a;
653*0a6a1f1dSLionel Sambuc   }
654*0a6a1f1dSLionel Sambuc #pragma omp sections
655*0a6a1f1dSLionel Sambuc   {
656*0a6a1f1dSLionel Sambuc #pragma omp target
657*0a6a1f1dSLionel Sambuc     ++a;
658*0a6a1f1dSLionel Sambuc   }
659*0a6a1f1dSLionel Sambuc #pragma omp sections
660*0a6a1f1dSLionel Sambuc   {
661*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
662*0a6a1f1dSLionel Sambuc     ++a;
663*0a6a1f1dSLionel Sambuc   }
664*0a6a1f1dSLionel Sambuc 
665*0a6a1f1dSLionel Sambuc // SECTION DIRECTIVE
666*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}}
667*0a6a1f1dSLionel Sambuc   {
668*0a6a1f1dSLionel Sambuc     bar();
669*0a6a1f1dSLionel Sambuc   }
670*0a6a1f1dSLionel Sambuc #pragma omp sections
671*0a6a1f1dSLionel Sambuc   {
672*0a6a1f1dSLionel Sambuc #pragma omp section
673*0a6a1f1dSLionel Sambuc     {
674*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
675*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
676*0a6a1f1dSLionel Sambuc         ;
677*0a6a1f1dSLionel Sambuc     }
678*0a6a1f1dSLionel Sambuc   }
679*0a6a1f1dSLionel Sambuc #pragma omp sections
680*0a6a1f1dSLionel Sambuc   {
681*0a6a1f1dSLionel Sambuc #pragma omp section
682*0a6a1f1dSLionel Sambuc     {
683*0a6a1f1dSLionel Sambuc #pragma omp simd
684*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
685*0a6a1f1dSLionel Sambuc         ;
686*0a6a1f1dSLionel Sambuc     }
687*0a6a1f1dSLionel Sambuc   }
688*0a6a1f1dSLionel Sambuc #pragma omp sections
689*0a6a1f1dSLionel Sambuc   {
690*0a6a1f1dSLionel Sambuc #pragma omp section
691*0a6a1f1dSLionel Sambuc     {
692*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
693*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
694*0a6a1f1dSLionel Sambuc         ;
695*0a6a1f1dSLionel Sambuc     }
696*0a6a1f1dSLionel Sambuc   }
697*0a6a1f1dSLionel Sambuc #pragma omp sections
698*0a6a1f1dSLionel Sambuc   {
699*0a6a1f1dSLionel Sambuc #pragma omp section
700*0a6a1f1dSLionel Sambuc     {
701*0a6a1f1dSLionel Sambuc #pragma omp parallel
702*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
703*0a6a1f1dSLionel Sambuc         ;
704*0a6a1f1dSLionel Sambuc     }
705*0a6a1f1dSLionel Sambuc   }
706*0a6a1f1dSLionel Sambuc #pragma omp sections
707*0a6a1f1dSLionel Sambuc   {
708*0a6a1f1dSLionel Sambuc #pragma omp section
709*0a6a1f1dSLionel Sambuc     {
710*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
711*0a6a1f1dSLionel Sambuc       {
712*0a6a1f1dSLionel Sambuc         bar();
713*0a6a1f1dSLionel Sambuc       }
714*0a6a1f1dSLionel Sambuc     }
715*0a6a1f1dSLionel Sambuc   }
716*0a6a1f1dSLionel Sambuc #pragma omp sections
717*0a6a1f1dSLionel Sambuc   {
718*0a6a1f1dSLionel Sambuc #pragma omp section
719*0a6a1f1dSLionel Sambuc     {
720*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a section region}}
721*0a6a1f1dSLionel Sambuc       {
722*0a6a1f1dSLionel Sambuc         bar();
723*0a6a1f1dSLionel Sambuc       }
724*0a6a1f1dSLionel Sambuc     }
725*0a6a1f1dSLionel Sambuc   }
726*0a6a1f1dSLionel Sambuc #pragma omp sections
727*0a6a1f1dSLionel Sambuc   {
728*0a6a1f1dSLionel Sambuc #pragma omp section
729*0a6a1f1dSLionel Sambuc     {
730*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
731*0a6a1f1dSLionel Sambuc       bar();
732*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}}
733*0a6a1f1dSLionel Sambuc       bar();
734*0a6a1f1dSLionel Sambuc #pragma omp critical
735*0a6a1f1dSLionel Sambuc       bar();
736*0a6a1f1dSLionel Sambuc     }
737*0a6a1f1dSLionel Sambuc   }
738*0a6a1f1dSLionel Sambuc #pragma omp sections
739*0a6a1f1dSLionel Sambuc   {
740*0a6a1f1dSLionel Sambuc #pragma omp section
741*0a6a1f1dSLionel Sambuc     {
742*0a6a1f1dSLionel Sambuc #pragma omp parallel
743*0a6a1f1dSLionel Sambuc       {
744*0a6a1f1dSLionel Sambuc #pragma omp single // OK
745*0a6a1f1dSLionel Sambuc         {
746*0a6a1f1dSLionel Sambuc           bar();
747*0a6a1f1dSLionel Sambuc         }
748*0a6a1f1dSLionel Sambuc #pragma omp for // OK
749*0a6a1f1dSLionel Sambuc         for (int i = 0; i < 10; ++i)
750*0a6a1f1dSLionel Sambuc           ;
751*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
752*0a6a1f1dSLionel Sambuc         for (int i = 0; i < 10; ++i)
753*0a6a1f1dSLionel Sambuc           ;
754*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
755*0a6a1f1dSLionel Sambuc         {
756*0a6a1f1dSLionel Sambuc           bar();
757*0a6a1f1dSLionel Sambuc         }
758*0a6a1f1dSLionel Sambuc       }
759*0a6a1f1dSLionel Sambuc     }
760*0a6a1f1dSLionel Sambuc   }
761*0a6a1f1dSLionel Sambuc #pragma omp sections
762*0a6a1f1dSLionel Sambuc   {
763*0a6a1f1dSLionel Sambuc #pragma omp section
764*0a6a1f1dSLionel Sambuc     {
765*0a6a1f1dSLionel Sambuc #pragma omp parallel for
766*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
767*0a6a1f1dSLionel Sambuc         ;
768*0a6a1f1dSLionel Sambuc     }
769*0a6a1f1dSLionel Sambuc   }
770*0a6a1f1dSLionel Sambuc #pragma omp sections
771*0a6a1f1dSLionel Sambuc   {
772*0a6a1f1dSLionel Sambuc #pragma omp section
773*0a6a1f1dSLionel Sambuc     {
774*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
775*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
776*0a6a1f1dSLionel Sambuc         ;
777*0a6a1f1dSLionel Sambuc     }
778*0a6a1f1dSLionel Sambuc   }
779*0a6a1f1dSLionel Sambuc #pragma omp sections
780*0a6a1f1dSLionel Sambuc   {
781*0a6a1f1dSLionel Sambuc #pragma omp section
782*0a6a1f1dSLionel Sambuc     {
783*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
784*0a6a1f1dSLionel Sambuc       {
785*0a6a1f1dSLionel Sambuc         bar();
786*0a6a1f1dSLionel Sambuc       }
787*0a6a1f1dSLionel Sambuc     }
788*0a6a1f1dSLionel Sambuc   }
789*0a6a1f1dSLionel Sambuc #pragma omp sections
790*0a6a1f1dSLionel Sambuc   {
791*0a6a1f1dSLionel Sambuc #pragma omp section
792*0a6a1f1dSLionel Sambuc     {
793*0a6a1f1dSLionel Sambuc #pragma omp task
794*0a6a1f1dSLionel Sambuc       {
795*0a6a1f1dSLionel Sambuc         bar();
796*0a6a1f1dSLionel Sambuc       }
797*0a6a1f1dSLionel Sambuc     }
798*0a6a1f1dSLionel Sambuc   }
799*0a6a1f1dSLionel Sambuc #pragma omp sections
800*0a6a1f1dSLionel Sambuc   {
801*0a6a1f1dSLionel Sambuc #pragma omp section
802*0a6a1f1dSLionel Sambuc     {
803*0a6a1f1dSLionel Sambuc #pragma omp taskyield
804*0a6a1f1dSLionel Sambuc       bar();
805*0a6a1f1dSLionel Sambuc     }
806*0a6a1f1dSLionel Sambuc   }
807*0a6a1f1dSLionel Sambuc #pragma omp sections
808*0a6a1f1dSLionel Sambuc   {
809*0a6a1f1dSLionel Sambuc #pragma omp section
810*0a6a1f1dSLionel Sambuc     {
811*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'section' region}}
812*0a6a1f1dSLionel Sambuc       bar();
813*0a6a1f1dSLionel Sambuc     }
814*0a6a1f1dSLionel Sambuc   }
815*0a6a1f1dSLionel Sambuc #pragma omp sections
816*0a6a1f1dSLionel Sambuc   {
817*0a6a1f1dSLionel Sambuc #pragma omp section
818*0a6a1f1dSLionel Sambuc     {
819*0a6a1f1dSLionel Sambuc #pragma omp taskwait
820*0a6a1f1dSLionel Sambuc       bar();
821*0a6a1f1dSLionel Sambuc     }
822*0a6a1f1dSLionel Sambuc   }
823*0a6a1f1dSLionel Sambuc #pragma omp sections
824*0a6a1f1dSLionel Sambuc   {
825*0a6a1f1dSLionel Sambuc #pragma omp section
826*0a6a1f1dSLionel Sambuc     {
827*0a6a1f1dSLionel Sambuc #pragma omp flush
828*0a6a1f1dSLionel Sambuc       bar();
829*0a6a1f1dSLionel Sambuc     }
830*0a6a1f1dSLionel Sambuc   }
831*0a6a1f1dSLionel Sambuc #pragma omp sections
832*0a6a1f1dSLionel Sambuc   {
833*0a6a1f1dSLionel Sambuc #pragma omp section
834*0a6a1f1dSLionel Sambuc     {
835*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
836*0a6a1f1dSLionel Sambuc       bar();
837*0a6a1f1dSLionel Sambuc     }
838*0a6a1f1dSLionel Sambuc   }
839*0a6a1f1dSLionel Sambuc #pragma omp sections
840*0a6a1f1dSLionel Sambuc   {
841*0a6a1f1dSLionel Sambuc #pragma omp section
842*0a6a1f1dSLionel Sambuc #pragma omp atomic
843*0a6a1f1dSLionel Sambuc     ++a;
844*0a6a1f1dSLionel Sambuc   }
845*0a6a1f1dSLionel Sambuc #pragma omp sections
846*0a6a1f1dSLionel Sambuc   {
847*0a6a1f1dSLionel Sambuc #pragma omp section
848*0a6a1f1dSLionel Sambuc #pragma omp target
849*0a6a1f1dSLionel Sambuc     ++a;
850*0a6a1f1dSLionel Sambuc   }
851*0a6a1f1dSLionel Sambuc #pragma omp sections
852*0a6a1f1dSLionel Sambuc   {
853*0a6a1f1dSLionel Sambuc #pragma omp section
854*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
855*0a6a1f1dSLionel Sambuc     ++a;
856*0a6a1f1dSLionel Sambuc   }
857*0a6a1f1dSLionel Sambuc 
858*0a6a1f1dSLionel Sambuc // SINGLE DIRECTIVE
859*0a6a1f1dSLionel Sambuc #pragma omp single
860*0a6a1f1dSLionel Sambuc   {
861*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
862*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
863*0a6a1f1dSLionel Sambuc       ;
864*0a6a1f1dSLionel Sambuc   }
865*0a6a1f1dSLionel Sambuc #pragma omp single
866*0a6a1f1dSLionel Sambuc   {
867*0a6a1f1dSLionel Sambuc #pragma omp simd
868*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
869*0a6a1f1dSLionel Sambuc       ;
870*0a6a1f1dSLionel Sambuc   }
871*0a6a1f1dSLionel Sambuc #pragma omp single
872*0a6a1f1dSLionel Sambuc   {
873*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
874*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
875*0a6a1f1dSLionel Sambuc       ;
876*0a6a1f1dSLionel Sambuc   }
877*0a6a1f1dSLionel Sambuc #pragma omp single
878*0a6a1f1dSLionel Sambuc   {
879*0a6a1f1dSLionel Sambuc #pragma omp parallel
880*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
881*0a6a1f1dSLionel Sambuc       ;
882*0a6a1f1dSLionel Sambuc   }
883*0a6a1f1dSLionel Sambuc #pragma omp single
884*0a6a1f1dSLionel Sambuc   {
885*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
886*0a6a1f1dSLionel Sambuc     {
887*0a6a1f1dSLionel Sambuc       bar();
888*0a6a1f1dSLionel Sambuc     }
889*0a6a1f1dSLionel Sambuc   }
890*0a6a1f1dSLionel Sambuc #pragma omp single
891*0a6a1f1dSLionel Sambuc   {
892*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'single' region}}
893*0a6a1f1dSLionel Sambuc     {
894*0a6a1f1dSLionel Sambuc       bar();
895*0a6a1f1dSLionel Sambuc     }
896*0a6a1f1dSLionel Sambuc   }
897*0a6a1f1dSLionel Sambuc #pragma omp single
898*0a6a1f1dSLionel Sambuc   {
899*0a6a1f1dSLionel Sambuc #pragma omp critical
900*0a6a1f1dSLionel Sambuc     {
901*0a6a1f1dSLionel Sambuc       bar();
902*0a6a1f1dSLionel Sambuc     }
903*0a6a1f1dSLionel Sambuc   }
904*0a6a1f1dSLionel Sambuc #pragma omp single
905*0a6a1f1dSLionel Sambuc   {
906*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
907*0a6a1f1dSLionel Sambuc     {
908*0a6a1f1dSLionel Sambuc       bar();
909*0a6a1f1dSLionel Sambuc     }
910*0a6a1f1dSLionel Sambuc   }
911*0a6a1f1dSLionel Sambuc #pragma omp single
912*0a6a1f1dSLionel Sambuc   {
913*0a6a1f1dSLionel Sambuc #pragma omp parallel
914*0a6a1f1dSLionel Sambuc     {
915*0a6a1f1dSLionel Sambuc #pragma omp single // OK
916*0a6a1f1dSLionel Sambuc       {
917*0a6a1f1dSLionel Sambuc         bar();
918*0a6a1f1dSLionel Sambuc       }
919*0a6a1f1dSLionel Sambuc #pragma omp for // OK
920*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
921*0a6a1f1dSLionel Sambuc         ;
922*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
923*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
924*0a6a1f1dSLionel Sambuc         ;
925*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
926*0a6a1f1dSLionel Sambuc       {
927*0a6a1f1dSLionel Sambuc         bar();
928*0a6a1f1dSLionel Sambuc       }
929*0a6a1f1dSLionel Sambuc     }
930*0a6a1f1dSLionel Sambuc   }
931*0a6a1f1dSLionel Sambuc #pragma omp single
932*0a6a1f1dSLionel Sambuc   {
933*0a6a1f1dSLionel Sambuc #pragma omp parallel for
934*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
935*0a6a1f1dSLionel Sambuc       ;
936*0a6a1f1dSLionel Sambuc   }
937*0a6a1f1dSLionel Sambuc #pragma omp single
938*0a6a1f1dSLionel Sambuc   {
939*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
940*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
941*0a6a1f1dSLionel Sambuc       ;
942*0a6a1f1dSLionel Sambuc   }
943*0a6a1f1dSLionel Sambuc #pragma omp single
944*0a6a1f1dSLionel Sambuc   {
945*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
946*0a6a1f1dSLionel Sambuc     {
947*0a6a1f1dSLionel Sambuc       bar();
948*0a6a1f1dSLionel Sambuc     }
949*0a6a1f1dSLionel Sambuc   }
950*0a6a1f1dSLionel Sambuc #pragma omp single
951*0a6a1f1dSLionel Sambuc   {
952*0a6a1f1dSLionel Sambuc #pragma omp task
953*0a6a1f1dSLionel Sambuc     {
954*0a6a1f1dSLionel Sambuc       bar();
955*0a6a1f1dSLionel Sambuc     }
956*0a6a1f1dSLionel Sambuc   }
957*0a6a1f1dSLionel Sambuc #pragma omp single
958*0a6a1f1dSLionel Sambuc   {
959*0a6a1f1dSLionel Sambuc #pragma omp taskyield
960*0a6a1f1dSLionel Sambuc     bar();
961*0a6a1f1dSLionel Sambuc   }
962*0a6a1f1dSLionel Sambuc #pragma omp single
963*0a6a1f1dSLionel Sambuc   {
964*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'single' region}}
965*0a6a1f1dSLionel Sambuc     bar();
966*0a6a1f1dSLionel Sambuc   }
967*0a6a1f1dSLionel Sambuc #pragma omp single
968*0a6a1f1dSLionel Sambuc   {
969*0a6a1f1dSLionel Sambuc #pragma omp taskwait
970*0a6a1f1dSLionel Sambuc     bar();
971*0a6a1f1dSLionel Sambuc   }
972*0a6a1f1dSLionel Sambuc #pragma omp single
973*0a6a1f1dSLionel Sambuc   {
974*0a6a1f1dSLionel Sambuc #pragma omp flush
975*0a6a1f1dSLionel Sambuc     bar();
976*0a6a1f1dSLionel Sambuc   }
977*0a6a1f1dSLionel Sambuc #pragma omp single
978*0a6a1f1dSLionel Sambuc   {
979*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
980*0a6a1f1dSLionel Sambuc     bar();
981*0a6a1f1dSLionel Sambuc   }
982*0a6a1f1dSLionel Sambuc #pragma omp single
983*0a6a1f1dSLionel Sambuc   {
984*0a6a1f1dSLionel Sambuc #pragma omp atomic
985*0a6a1f1dSLionel Sambuc     ++a;
986*0a6a1f1dSLionel Sambuc   }
987*0a6a1f1dSLionel Sambuc #pragma omp single
988*0a6a1f1dSLionel Sambuc   {
989*0a6a1f1dSLionel Sambuc #pragma omp target
990*0a6a1f1dSLionel Sambuc     ++a;
991*0a6a1f1dSLionel Sambuc   }
992*0a6a1f1dSLionel Sambuc #pragma omp single
993*0a6a1f1dSLionel Sambuc   {
994*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
995*0a6a1f1dSLionel Sambuc     ++a;
996*0a6a1f1dSLionel Sambuc   }
997*0a6a1f1dSLionel Sambuc 
998*0a6a1f1dSLionel Sambuc // MASTER DIRECTIVE
999*0a6a1f1dSLionel Sambuc #pragma omp master
1000*0a6a1f1dSLionel Sambuc   {
1001*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
1002*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1003*0a6a1f1dSLionel Sambuc       ;
1004*0a6a1f1dSLionel Sambuc   }
1005*0a6a1f1dSLionel Sambuc #pragma omp master
1006*0a6a1f1dSLionel Sambuc   {
1007*0a6a1f1dSLionel Sambuc #pragma omp simd
1008*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1009*0a6a1f1dSLionel Sambuc       ;
1010*0a6a1f1dSLionel Sambuc   }
1011*0a6a1f1dSLionel Sambuc #pragma omp master
1012*0a6a1f1dSLionel Sambuc   {
1013*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
1014*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1015*0a6a1f1dSLionel Sambuc       ;
1016*0a6a1f1dSLionel Sambuc   }
1017*0a6a1f1dSLionel Sambuc #pragma omp master
1018*0a6a1f1dSLionel Sambuc   {
1019*0a6a1f1dSLionel Sambuc #pragma omp parallel
1020*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1021*0a6a1f1dSLionel Sambuc       ;
1022*0a6a1f1dSLionel Sambuc   }
1023*0a6a1f1dSLionel Sambuc #pragma omp master
1024*0a6a1f1dSLionel Sambuc   {
1025*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
1026*0a6a1f1dSLionel Sambuc     {
1027*0a6a1f1dSLionel Sambuc       bar();
1028*0a6a1f1dSLionel Sambuc     }
1029*0a6a1f1dSLionel Sambuc   }
1030*0a6a1f1dSLionel Sambuc #pragma omp master
1031*0a6a1f1dSLionel Sambuc   {
1032*0a6a1f1dSLionel Sambuc #pragma omp master // OK, though second 'master' is redundant
1033*0a6a1f1dSLionel Sambuc     {
1034*0a6a1f1dSLionel Sambuc       bar();
1035*0a6a1f1dSLionel Sambuc     }
1036*0a6a1f1dSLionel Sambuc   }
1037*0a6a1f1dSLionel Sambuc #pragma omp master
1038*0a6a1f1dSLionel Sambuc   {
1039*0a6a1f1dSLionel Sambuc #pragma omp critical
1040*0a6a1f1dSLionel Sambuc     {
1041*0a6a1f1dSLionel Sambuc       bar();
1042*0a6a1f1dSLionel Sambuc     }
1043*0a6a1f1dSLionel Sambuc   }
1044*0a6a1f1dSLionel Sambuc #pragma omp master
1045*0a6a1f1dSLionel Sambuc   {
1046*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
1047*0a6a1f1dSLionel Sambuc     {
1048*0a6a1f1dSLionel Sambuc       bar();
1049*0a6a1f1dSLionel Sambuc     }
1050*0a6a1f1dSLionel Sambuc   }
1051*0a6a1f1dSLionel Sambuc #pragma omp master
1052*0a6a1f1dSLionel Sambuc   {
1053*0a6a1f1dSLionel Sambuc #pragma omp parallel
1054*0a6a1f1dSLionel Sambuc     {
1055*0a6a1f1dSLionel Sambuc #pragma omp master // OK
1056*0a6a1f1dSLionel Sambuc       {
1057*0a6a1f1dSLionel Sambuc         bar();
1058*0a6a1f1dSLionel Sambuc       }
1059*0a6a1f1dSLionel Sambuc #pragma omp for // OK
1060*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
1061*0a6a1f1dSLionel Sambuc         ;
1062*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
1063*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
1064*0a6a1f1dSLionel Sambuc         ;
1065*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
1066*0a6a1f1dSLionel Sambuc       {
1067*0a6a1f1dSLionel Sambuc         bar();
1068*0a6a1f1dSLionel Sambuc       }
1069*0a6a1f1dSLionel Sambuc     }
1070*0a6a1f1dSLionel Sambuc   }
1071*0a6a1f1dSLionel Sambuc #pragma omp master
1072*0a6a1f1dSLionel Sambuc   {
1073*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1074*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1075*0a6a1f1dSLionel Sambuc       ;
1076*0a6a1f1dSLionel Sambuc   }
1077*0a6a1f1dSLionel Sambuc #pragma omp master
1078*0a6a1f1dSLionel Sambuc   {
1079*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1080*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1081*0a6a1f1dSLionel Sambuc       ;
1082*0a6a1f1dSLionel Sambuc   }
1083*0a6a1f1dSLionel Sambuc #pragma omp master
1084*0a6a1f1dSLionel Sambuc   {
1085*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1086*0a6a1f1dSLionel Sambuc     {
1087*0a6a1f1dSLionel Sambuc       bar();
1088*0a6a1f1dSLionel Sambuc     }
1089*0a6a1f1dSLionel Sambuc   }
1090*0a6a1f1dSLionel Sambuc #pragma omp master
1091*0a6a1f1dSLionel Sambuc   {
1092*0a6a1f1dSLionel Sambuc #pragma omp task
1093*0a6a1f1dSLionel Sambuc     {
1094*0a6a1f1dSLionel Sambuc       bar();
1095*0a6a1f1dSLionel Sambuc     }
1096*0a6a1f1dSLionel Sambuc   }
1097*0a6a1f1dSLionel Sambuc #pragma omp master
1098*0a6a1f1dSLionel Sambuc   {
1099*0a6a1f1dSLionel Sambuc #pragma omp taskyield
1100*0a6a1f1dSLionel Sambuc     bar();
1101*0a6a1f1dSLionel Sambuc   }
1102*0a6a1f1dSLionel Sambuc #pragma omp master
1103*0a6a1f1dSLionel Sambuc   {
1104*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'master' region}}
1105*0a6a1f1dSLionel Sambuc     bar();
1106*0a6a1f1dSLionel Sambuc   }
1107*0a6a1f1dSLionel Sambuc #pragma omp master
1108*0a6a1f1dSLionel Sambuc   {
1109*0a6a1f1dSLionel Sambuc #pragma omp taskwait
1110*0a6a1f1dSLionel Sambuc     bar();
1111*0a6a1f1dSLionel Sambuc   }
1112*0a6a1f1dSLionel Sambuc #pragma omp master
1113*0a6a1f1dSLionel Sambuc   {
1114*0a6a1f1dSLionel Sambuc #pragma omp flush
1115*0a6a1f1dSLionel Sambuc     bar();
1116*0a6a1f1dSLionel Sambuc   }
1117*0a6a1f1dSLionel Sambuc #pragma omp master
1118*0a6a1f1dSLionel Sambuc   {
1119*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
1120*0a6a1f1dSLionel Sambuc     bar();
1121*0a6a1f1dSLionel Sambuc   }
1122*0a6a1f1dSLionel Sambuc #pragma omp master
1123*0a6a1f1dSLionel Sambuc   {
1124*0a6a1f1dSLionel Sambuc #pragma omp atomic
1125*0a6a1f1dSLionel Sambuc     ++a;
1126*0a6a1f1dSLionel Sambuc   }
1127*0a6a1f1dSLionel Sambuc #pragma omp master
1128*0a6a1f1dSLionel Sambuc   {
1129*0a6a1f1dSLionel Sambuc #pragma omp target
1130*0a6a1f1dSLionel Sambuc     ++a;
1131*0a6a1f1dSLionel Sambuc   }
1132*0a6a1f1dSLionel Sambuc #pragma omp master
1133*0a6a1f1dSLionel Sambuc   {
1134*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
1135*0a6a1f1dSLionel Sambuc     ++a;
1136*0a6a1f1dSLionel Sambuc   }
1137*0a6a1f1dSLionel Sambuc 
1138*0a6a1f1dSLionel Sambuc // CRITICAL DIRECTIVE
1139*0a6a1f1dSLionel Sambuc #pragma omp critical
1140*0a6a1f1dSLionel Sambuc   {
1141*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
1142*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1143*0a6a1f1dSLionel Sambuc       ;
1144*0a6a1f1dSLionel Sambuc   }
1145*0a6a1f1dSLionel Sambuc #pragma omp critical
1146*0a6a1f1dSLionel Sambuc   {
1147*0a6a1f1dSLionel Sambuc #pragma omp simd
1148*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1149*0a6a1f1dSLionel Sambuc       ;
1150*0a6a1f1dSLionel Sambuc   }
1151*0a6a1f1dSLionel Sambuc #pragma omp critical
1152*0a6a1f1dSLionel Sambuc   {
1153*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
1154*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1155*0a6a1f1dSLionel Sambuc       ;
1156*0a6a1f1dSLionel Sambuc   }
1157*0a6a1f1dSLionel Sambuc #pragma omp critical
1158*0a6a1f1dSLionel Sambuc   {
1159*0a6a1f1dSLionel Sambuc #pragma omp parallel
1160*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1161*0a6a1f1dSLionel Sambuc       ;
1162*0a6a1f1dSLionel Sambuc   }
1163*0a6a1f1dSLionel Sambuc #pragma omp critical
1164*0a6a1f1dSLionel Sambuc   {
1165*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
1166*0a6a1f1dSLionel Sambuc     {
1167*0a6a1f1dSLionel Sambuc       bar();
1168*0a6a1f1dSLionel Sambuc     }
1169*0a6a1f1dSLionel Sambuc   }
1170*0a6a1f1dSLionel Sambuc #pragma omp critical
1171*0a6a1f1dSLionel Sambuc   {
1172*0a6a1f1dSLionel Sambuc #pragma omp master // OK, though second 'master' is redundant
1173*0a6a1f1dSLionel Sambuc     {
1174*0a6a1f1dSLionel Sambuc       bar();
1175*0a6a1f1dSLionel Sambuc     }
1176*0a6a1f1dSLionel Sambuc   }
1177*0a6a1f1dSLionel Sambuc #pragma omp critical
1178*0a6a1f1dSLionel Sambuc   {
1179*0a6a1f1dSLionel Sambuc #pragma omp critical
1180*0a6a1f1dSLionel Sambuc     {
1181*0a6a1f1dSLionel Sambuc       bar();
1182*0a6a1f1dSLionel Sambuc     }
1183*0a6a1f1dSLionel Sambuc   }
1184*0a6a1f1dSLionel Sambuc #pragma omp critical
1185*0a6a1f1dSLionel Sambuc   {
1186*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
1187*0a6a1f1dSLionel Sambuc     {
1188*0a6a1f1dSLionel Sambuc       bar();
1189*0a6a1f1dSLionel Sambuc     }
1190*0a6a1f1dSLionel Sambuc   }
1191*0a6a1f1dSLionel Sambuc #pragma omp critical
1192*0a6a1f1dSLionel Sambuc   {
1193*0a6a1f1dSLionel Sambuc #pragma omp parallel
1194*0a6a1f1dSLionel Sambuc     {
1195*0a6a1f1dSLionel Sambuc #pragma omp master // OK
1196*0a6a1f1dSLionel Sambuc       {
1197*0a6a1f1dSLionel Sambuc         bar();
1198*0a6a1f1dSLionel Sambuc       }
1199*0a6a1f1dSLionel Sambuc #pragma omp for // OK
1200*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
1201*0a6a1f1dSLionel Sambuc         ;
1202*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
1203*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
1204*0a6a1f1dSLionel Sambuc         ;
1205*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
1206*0a6a1f1dSLionel Sambuc       {
1207*0a6a1f1dSLionel Sambuc         bar();
1208*0a6a1f1dSLionel Sambuc       }
1209*0a6a1f1dSLionel Sambuc     }
1210*0a6a1f1dSLionel Sambuc   }
1211*0a6a1f1dSLionel Sambuc #pragma omp critical
1212*0a6a1f1dSLionel Sambuc   {
1213*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1214*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1215*0a6a1f1dSLionel Sambuc       ;
1216*0a6a1f1dSLionel Sambuc   }
1217*0a6a1f1dSLionel Sambuc #pragma omp critical
1218*0a6a1f1dSLionel Sambuc   {
1219*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1220*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1221*0a6a1f1dSLionel Sambuc       ;
1222*0a6a1f1dSLionel Sambuc   }
1223*0a6a1f1dSLionel Sambuc #pragma omp critical
1224*0a6a1f1dSLionel Sambuc   {
1225*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1226*0a6a1f1dSLionel Sambuc     {
1227*0a6a1f1dSLionel Sambuc       bar();
1228*0a6a1f1dSLionel Sambuc     }
1229*0a6a1f1dSLionel Sambuc   }
1230*0a6a1f1dSLionel Sambuc #pragma omp critical
1231*0a6a1f1dSLionel Sambuc   {
1232*0a6a1f1dSLionel Sambuc #pragma omp task
1233*0a6a1f1dSLionel Sambuc     {
1234*0a6a1f1dSLionel Sambuc       bar();
1235*0a6a1f1dSLionel Sambuc     }
1236*0a6a1f1dSLionel Sambuc   }
1237*0a6a1f1dSLionel Sambuc #pragma omp critical
1238*0a6a1f1dSLionel Sambuc   {
1239*0a6a1f1dSLionel Sambuc #pragma omp taskyield
1240*0a6a1f1dSLionel Sambuc     bar();
1241*0a6a1f1dSLionel Sambuc   }
1242*0a6a1f1dSLionel Sambuc #pragma omp critical
1243*0a6a1f1dSLionel Sambuc   {
1244*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'critical' region}}
1245*0a6a1f1dSLionel Sambuc     bar();
1246*0a6a1f1dSLionel Sambuc   }
1247*0a6a1f1dSLionel Sambuc #pragma omp critical
1248*0a6a1f1dSLionel Sambuc   {
1249*0a6a1f1dSLionel Sambuc #pragma omp taskwait
1250*0a6a1f1dSLionel Sambuc     bar();
1251*0a6a1f1dSLionel Sambuc   }
1252*0a6a1f1dSLionel Sambuc #pragma omp critical(Tuzik)
1253*0a6a1f1dSLionel Sambuc   {
1254*0a6a1f1dSLionel Sambuc #pragma omp critical(grelka)
1255*0a6a1f1dSLionel Sambuc     bar();
1256*0a6a1f1dSLionel Sambuc   }
1257*0a6a1f1dSLionel Sambuc #pragma omp critical(Belka) // expected-note {{previous 'critical' region starts here}}
1258*0a6a1f1dSLionel Sambuc   {
1259*0a6a1f1dSLionel Sambuc #pragma omp critical(Belka) // expected-error {{cannot nest 'critical' regions having the same name 'Belka'}}
1260*0a6a1f1dSLionel Sambuc     {
1261*0a6a1f1dSLionel Sambuc #pragma omp critical(Tuzik)
1262*0a6a1f1dSLionel Sambuc       {
1263*0a6a1f1dSLionel Sambuc #pragma omp parallel
1264*0a6a1f1dSLionel Sambuc #pragma omp critical(grelka)
1265*0a6a1f1dSLionel Sambuc         {
1266*0a6a1f1dSLionel Sambuc           bar();
1267*0a6a1f1dSLionel Sambuc         }
1268*0a6a1f1dSLionel Sambuc       }
1269*0a6a1f1dSLionel Sambuc     }
1270*0a6a1f1dSLionel Sambuc   }
1271*0a6a1f1dSLionel Sambuc #pragma omp critical
1272*0a6a1f1dSLionel Sambuc   {
1273*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
1274*0a6a1f1dSLionel Sambuc     bar();
1275*0a6a1f1dSLionel Sambuc   }
1276*0a6a1f1dSLionel Sambuc #pragma omp critical
1277*0a6a1f1dSLionel Sambuc   {
1278*0a6a1f1dSLionel Sambuc #pragma omp atomic
1279*0a6a1f1dSLionel Sambuc     ++a;
1280*0a6a1f1dSLionel Sambuc   }
1281*0a6a1f1dSLionel Sambuc #pragma omp critical
1282*0a6a1f1dSLionel Sambuc   {
1283*0a6a1f1dSLionel Sambuc #pragma omp target
1284*0a6a1f1dSLionel Sambuc     ++a;
1285*0a6a1f1dSLionel Sambuc   }
1286*0a6a1f1dSLionel Sambuc #pragma omp critical
1287*0a6a1f1dSLionel Sambuc   {
1288*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
1289*0a6a1f1dSLionel Sambuc     ++a;
1290*0a6a1f1dSLionel Sambuc   }
1291*0a6a1f1dSLionel Sambuc 
1292*0a6a1f1dSLionel Sambuc // PARALLEL FOR DIRECTIVE
1293*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1294*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1295*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
1296*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1297*0a6a1f1dSLionel Sambuc       ;
1298*0a6a1f1dSLionel Sambuc   }
1299*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1300*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1301*0a6a1f1dSLionel Sambuc #pragma omp simd
1302*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1303*0a6a1f1dSLionel Sambuc       ;
1304*0a6a1f1dSLionel Sambuc   }
1305*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1306*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1307*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
1308*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1309*0a6a1f1dSLionel Sambuc       ;
1310*0a6a1f1dSLionel Sambuc   }
1311*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1312*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1313*0a6a1f1dSLionel Sambuc #pragma omp parallel
1314*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1315*0a6a1f1dSLionel Sambuc       ;
1316*0a6a1f1dSLionel Sambuc   }
1317*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1318*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1319*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
1320*0a6a1f1dSLionel Sambuc     {
1321*0a6a1f1dSLionel Sambuc       bar();
1322*0a6a1f1dSLionel Sambuc     }
1323*0a6a1f1dSLionel Sambuc   }
1324*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1325*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1326*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel for region}}
1327*0a6a1f1dSLionel Sambuc     {
1328*0a6a1f1dSLionel Sambuc       bar();
1329*0a6a1f1dSLionel Sambuc     }
1330*0a6a1f1dSLionel Sambuc   }
1331*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1332*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1333*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
1334*0a6a1f1dSLionel Sambuc     {
1335*0a6a1f1dSLionel Sambuc       bar();
1336*0a6a1f1dSLionel Sambuc     }
1337*0a6a1f1dSLionel Sambuc   }
1338*0a6a1f1dSLionel Sambuc 
1339*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1340*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1341*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'parallel for' region}}
1342*0a6a1f1dSLionel Sambuc     {
1343*0a6a1f1dSLionel Sambuc       bar();
1344*0a6a1f1dSLionel Sambuc     }
1345*0a6a1f1dSLionel Sambuc   }
1346*0a6a1f1dSLionel Sambuc 
1347*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1348*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1349*0a6a1f1dSLionel Sambuc #pragma omp critical
1350*0a6a1f1dSLionel Sambuc     {
1351*0a6a1f1dSLionel Sambuc       bar();
1352*0a6a1f1dSLionel Sambuc     }
1353*0a6a1f1dSLionel Sambuc   }
1354*0a6a1f1dSLionel Sambuc 
1355*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1356*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1357*0a6a1f1dSLionel Sambuc #pragma omp parallel
1358*0a6a1f1dSLionel Sambuc     {
1359*0a6a1f1dSLionel Sambuc #pragma omp single // OK
1360*0a6a1f1dSLionel Sambuc       {
1361*0a6a1f1dSLionel Sambuc         bar();
1362*0a6a1f1dSLionel Sambuc       }
1363*0a6a1f1dSLionel Sambuc #pragma omp for // OK
1364*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
1365*0a6a1f1dSLionel Sambuc         ;
1366*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
1367*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
1368*0a6a1f1dSLionel Sambuc         ;
1369*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
1370*0a6a1f1dSLionel Sambuc       {
1371*0a6a1f1dSLionel Sambuc         bar();
1372*0a6a1f1dSLionel Sambuc       }
1373*0a6a1f1dSLionel Sambuc     }
1374*0a6a1f1dSLionel Sambuc   }
1375*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1376*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1377*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1378*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1379*0a6a1f1dSLionel Sambuc       ;
1380*0a6a1f1dSLionel Sambuc   }
1381*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1382*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1383*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1384*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1385*0a6a1f1dSLionel Sambuc       ;
1386*0a6a1f1dSLionel Sambuc   }
1387*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1388*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1389*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1390*0a6a1f1dSLionel Sambuc     {
1391*0a6a1f1dSLionel Sambuc       bar();
1392*0a6a1f1dSLionel Sambuc     }
1393*0a6a1f1dSLionel Sambuc   }
1394*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1395*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1396*0a6a1f1dSLionel Sambuc #pragma omp task
1397*0a6a1f1dSLionel Sambuc     {
1398*0a6a1f1dSLionel Sambuc       bar();
1399*0a6a1f1dSLionel Sambuc     }
1400*0a6a1f1dSLionel Sambuc   }
1401*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1402*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1403*0a6a1f1dSLionel Sambuc #pragma omp taskyield
1404*0a6a1f1dSLionel Sambuc     bar();
1405*0a6a1f1dSLionel Sambuc   }
1406*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1407*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1408*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel for' region}}
1409*0a6a1f1dSLionel Sambuc     bar();
1410*0a6a1f1dSLionel Sambuc   }
1411*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1412*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1413*0a6a1f1dSLionel Sambuc #pragma omp taskwait
1414*0a6a1f1dSLionel Sambuc     bar();
1415*0a6a1f1dSLionel Sambuc   }
1416*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1417*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1418*0a6a1f1dSLionel Sambuc #pragma omp flush
1419*0a6a1f1dSLionel Sambuc     bar();
1420*0a6a1f1dSLionel Sambuc   }
1421*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1422*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1423*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
1424*0a6a1f1dSLionel Sambuc     bar();
1425*0a6a1f1dSLionel Sambuc   }
1426*0a6a1f1dSLionel Sambuc #pragma omp parallel for ordered
1427*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1428*0a6a1f1dSLionel Sambuc #pragma omp ordered // OK
1429*0a6a1f1dSLionel Sambuc     bar();
1430*0a6a1f1dSLionel Sambuc   }
1431*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1432*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1433*0a6a1f1dSLionel Sambuc #pragma omp atomic
1434*0a6a1f1dSLionel Sambuc     ++a;
1435*0a6a1f1dSLionel Sambuc   }
1436*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1437*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1438*0a6a1f1dSLionel Sambuc #pragma omp target
1439*0a6a1f1dSLionel Sambuc     ++a;
1440*0a6a1f1dSLionel Sambuc   }
1441*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1442*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1443*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
1444*0a6a1f1dSLionel Sambuc     ++a;
1445*0a6a1f1dSLionel Sambuc   }
1446*0a6a1f1dSLionel Sambuc 
1447*0a6a1f1dSLionel Sambuc // PARALLEL FOR SIMD DIRECTIVE
1448*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1449*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1450*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1451*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1452*0a6a1f1dSLionel Sambuc       ;
1453*0a6a1f1dSLionel Sambuc   }
1454*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1455*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1456*0a6a1f1dSLionel Sambuc #pragma omp simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
1457*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1458*0a6a1f1dSLionel Sambuc       ;
1459*0a6a1f1dSLionel Sambuc   }
1460*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1461*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1462*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1463*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1464*0a6a1f1dSLionel Sambuc       ;
1465*0a6a1f1dSLionel Sambuc   }
1466*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1467*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1468*0a6a1f1dSLionel Sambuc #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1469*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1470*0a6a1f1dSLionel Sambuc       ;
1471*0a6a1f1dSLionel Sambuc   }
1472*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1473*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1474*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1475*0a6a1f1dSLionel Sambuc     {
1476*0a6a1f1dSLionel Sambuc       bar();
1477*0a6a1f1dSLionel Sambuc     }
1478*0a6a1f1dSLionel Sambuc   }
1479*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1480*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1481*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1482*0a6a1f1dSLionel Sambuc     {
1483*0a6a1f1dSLionel Sambuc       bar();
1484*0a6a1f1dSLionel Sambuc     }
1485*0a6a1f1dSLionel Sambuc   }
1486*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1487*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1488*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1489*0a6a1f1dSLionel Sambuc     {
1490*0a6a1f1dSLionel Sambuc       bar();
1491*0a6a1f1dSLionel Sambuc     }
1492*0a6a1f1dSLionel Sambuc   }
1493*0a6a1f1dSLionel Sambuc 
1494*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1495*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1496*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1497*0a6a1f1dSLionel Sambuc     {
1498*0a6a1f1dSLionel Sambuc       bar();
1499*0a6a1f1dSLionel Sambuc     }
1500*0a6a1f1dSLionel Sambuc   }
1501*0a6a1f1dSLionel Sambuc 
1502*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1503*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1504*0a6a1f1dSLionel Sambuc #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1505*0a6a1f1dSLionel Sambuc     {
1506*0a6a1f1dSLionel Sambuc       bar();
1507*0a6a1f1dSLionel Sambuc     }
1508*0a6a1f1dSLionel Sambuc   }
1509*0a6a1f1dSLionel Sambuc 
1510*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1511*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1512*0a6a1f1dSLionel Sambuc #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1513*0a6a1f1dSLionel Sambuc     {
1514*0a6a1f1dSLionel Sambuc #pragma omp single
1515*0a6a1f1dSLionel Sambuc       {
1516*0a6a1f1dSLionel Sambuc         bar();
1517*0a6a1f1dSLionel Sambuc       }
1518*0a6a1f1dSLionel Sambuc #pragma omp for
1519*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
1520*0a6a1f1dSLionel Sambuc         ;
1521*0a6a1f1dSLionel Sambuc #pragma omp for simd
1522*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
1523*0a6a1f1dSLionel Sambuc         ;
1524*0a6a1f1dSLionel Sambuc #pragma omp sections
1525*0a6a1f1dSLionel Sambuc       {
1526*0a6a1f1dSLionel Sambuc         bar();
1527*0a6a1f1dSLionel Sambuc       }
1528*0a6a1f1dSLionel Sambuc     }
1529*0a6a1f1dSLionel Sambuc   }
1530*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1531*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1532*0a6a1f1dSLionel Sambuc #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1533*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1534*0a6a1f1dSLionel Sambuc       ;
1535*0a6a1f1dSLionel Sambuc   }
1536*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1537*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1538*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
1539*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1540*0a6a1f1dSLionel Sambuc       ;
1541*0a6a1f1dSLionel Sambuc   }
1542*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1543*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1544*0a6a1f1dSLionel Sambuc #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1545*0a6a1f1dSLionel Sambuc     {
1546*0a6a1f1dSLionel Sambuc       bar();
1547*0a6a1f1dSLionel Sambuc     }
1548*0a6a1f1dSLionel Sambuc   }
1549*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1550*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1551*0a6a1f1dSLionel Sambuc #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1552*0a6a1f1dSLionel Sambuc     {
1553*0a6a1f1dSLionel Sambuc       bar();
1554*0a6a1f1dSLionel Sambuc     }
1555*0a6a1f1dSLionel Sambuc   }
1556*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1557*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1558*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1559*0a6a1f1dSLionel Sambuc     bar();
1560*0a6a1f1dSLionel Sambuc   }
1561*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1562*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1563*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1564*0a6a1f1dSLionel Sambuc     bar();
1565*0a6a1f1dSLionel Sambuc   }
1566*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1567*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1568*0a6a1f1dSLionel Sambuc #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1569*0a6a1f1dSLionel Sambuc     bar();
1570*0a6a1f1dSLionel Sambuc   }
1571*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1572*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1573*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1574*0a6a1f1dSLionel Sambuc     bar();
1575*0a6a1f1dSLionel Sambuc   }
1576*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1577*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1578*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1579*0a6a1f1dSLionel Sambuc     bar();
1580*0a6a1f1dSLionel Sambuc   }
1581*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1582*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1583*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1584*0a6a1f1dSLionel Sambuc     bar();
1585*0a6a1f1dSLionel Sambuc   }
1586*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1587*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1588*0a6a1f1dSLionel Sambuc #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1589*0a6a1f1dSLionel Sambuc     ++a;
1590*0a6a1f1dSLionel Sambuc   }
1591*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1592*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1593*0a6a1f1dSLionel Sambuc #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1594*0a6a1f1dSLionel Sambuc     ++a;
1595*0a6a1f1dSLionel Sambuc   }
1596*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1597*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
1598*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1599*0a6a1f1dSLionel Sambuc     ++a;
1600*0a6a1f1dSLionel Sambuc   }
1601*0a6a1f1dSLionel Sambuc 
1602*0a6a1f1dSLionel Sambuc // PARALLEL SECTIONS DIRECTIVE
1603*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1604*0a6a1f1dSLionel Sambuc   {
1605*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
1606*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1607*0a6a1f1dSLionel Sambuc       ;
1608*0a6a1f1dSLionel Sambuc   }
1609*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1610*0a6a1f1dSLionel Sambuc   {
1611*0a6a1f1dSLionel Sambuc #pragma omp simd
1612*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1613*0a6a1f1dSLionel Sambuc       ;
1614*0a6a1f1dSLionel Sambuc   }
1615*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1616*0a6a1f1dSLionel Sambuc   {
1617*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
1618*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1619*0a6a1f1dSLionel Sambuc       ;
1620*0a6a1f1dSLionel Sambuc   }
1621*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1622*0a6a1f1dSLionel Sambuc   {
1623*0a6a1f1dSLionel Sambuc #pragma omp parallel
1624*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1625*0a6a1f1dSLionel Sambuc       ;
1626*0a6a1f1dSLionel Sambuc   }
1627*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1628*0a6a1f1dSLionel Sambuc   {
1629*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
1630*0a6a1f1dSLionel Sambuc     {
1631*0a6a1f1dSLionel Sambuc       bar();
1632*0a6a1f1dSLionel Sambuc     }
1633*0a6a1f1dSLionel Sambuc   }
1634*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1635*0a6a1f1dSLionel Sambuc   {
1636*0a6a1f1dSLionel Sambuc #pragma omp section
1637*0a6a1f1dSLionel Sambuc     {
1638*0a6a1f1dSLionel Sambuc       bar();
1639*0a6a1f1dSLionel Sambuc     }
1640*0a6a1f1dSLionel Sambuc   }
1641*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1642*0a6a1f1dSLionel Sambuc   {
1643*0a6a1f1dSLionel Sambuc #pragma omp section
1644*0a6a1f1dSLionel Sambuc     {
1645*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
1646*0a6a1f1dSLionel Sambuc       bar();
1647*0a6a1f1dSLionel Sambuc     }
1648*0a6a1f1dSLionel Sambuc   }
1649*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1650*0a6a1f1dSLionel Sambuc   {
1651*0a6a1f1dSLionel Sambuc #pragma omp section
1652*0a6a1f1dSLionel Sambuc     {
1653*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}}
1654*0a6a1f1dSLionel Sambuc       bar();
1655*0a6a1f1dSLionel Sambuc     }
1656*0a6a1f1dSLionel Sambuc   }
1657*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1658*0a6a1f1dSLionel Sambuc   {
1659*0a6a1f1dSLionel Sambuc #pragma omp section
1660*0a6a1f1dSLionel Sambuc     {
1661*0a6a1f1dSLionel Sambuc #pragma omp critical
1662*0a6a1f1dSLionel Sambuc       bar();
1663*0a6a1f1dSLionel Sambuc     }
1664*0a6a1f1dSLionel Sambuc   }
1665*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1666*0a6a1f1dSLionel Sambuc   {
1667*0a6a1f1dSLionel Sambuc #pragma omp parallel
1668*0a6a1f1dSLionel Sambuc     {
1669*0a6a1f1dSLionel Sambuc #pragma omp single // OK
1670*0a6a1f1dSLionel Sambuc       {
1671*0a6a1f1dSLionel Sambuc         bar();
1672*0a6a1f1dSLionel Sambuc       }
1673*0a6a1f1dSLionel Sambuc #pragma omp for // OK
1674*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
1675*0a6a1f1dSLionel Sambuc         ;
1676*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
1677*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
1678*0a6a1f1dSLionel Sambuc         ;
1679*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
1680*0a6a1f1dSLionel Sambuc       {
1681*0a6a1f1dSLionel Sambuc         bar();
1682*0a6a1f1dSLionel Sambuc       }
1683*0a6a1f1dSLionel Sambuc     }
1684*0a6a1f1dSLionel Sambuc   }
1685*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1686*0a6a1f1dSLionel Sambuc   {
1687*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1688*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1689*0a6a1f1dSLionel Sambuc       ;
1690*0a6a1f1dSLionel Sambuc   }
1691*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1692*0a6a1f1dSLionel Sambuc   {
1693*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1694*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1695*0a6a1f1dSLionel Sambuc       ;
1696*0a6a1f1dSLionel Sambuc   }
1697*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1698*0a6a1f1dSLionel Sambuc   {
1699*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1700*0a6a1f1dSLionel Sambuc     {
1701*0a6a1f1dSLionel Sambuc       bar();
1702*0a6a1f1dSLionel Sambuc     }
1703*0a6a1f1dSLionel Sambuc   }
1704*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1705*0a6a1f1dSLionel Sambuc   {
1706*0a6a1f1dSLionel Sambuc #pragma omp task
1707*0a6a1f1dSLionel Sambuc     {
1708*0a6a1f1dSLionel Sambuc       bar();
1709*0a6a1f1dSLionel Sambuc     }
1710*0a6a1f1dSLionel Sambuc   }
1711*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1712*0a6a1f1dSLionel Sambuc   {
1713*0a6a1f1dSLionel Sambuc #pragma omp taskyield
1714*0a6a1f1dSLionel Sambuc   }
1715*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1716*0a6a1f1dSLionel Sambuc   {
1717*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel sections' region}}
1718*0a6a1f1dSLionel Sambuc   }
1719*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1720*0a6a1f1dSLionel Sambuc   {
1721*0a6a1f1dSLionel Sambuc #pragma omp taskwait
1722*0a6a1f1dSLionel Sambuc   }
1723*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1724*0a6a1f1dSLionel Sambuc   {
1725*0a6a1f1dSLionel Sambuc #pragma omp flush
1726*0a6a1f1dSLionel Sambuc   }
1727*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1728*0a6a1f1dSLionel Sambuc   {
1729*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
1730*0a6a1f1dSLionel Sambuc     bar();
1731*0a6a1f1dSLionel Sambuc   }
1732*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1733*0a6a1f1dSLionel Sambuc   {
1734*0a6a1f1dSLionel Sambuc #pragma omp atomic
1735*0a6a1f1dSLionel Sambuc     ++a;
1736*0a6a1f1dSLionel Sambuc   }
1737*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1738*0a6a1f1dSLionel Sambuc   {
1739*0a6a1f1dSLionel Sambuc #pragma omp target
1740*0a6a1f1dSLionel Sambuc     ++a;
1741*0a6a1f1dSLionel Sambuc   }
1742*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1743*0a6a1f1dSLionel Sambuc   {
1744*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
1745*0a6a1f1dSLionel Sambuc     ++a;
1746*0a6a1f1dSLionel Sambuc   }
1747*0a6a1f1dSLionel Sambuc 
1748*0a6a1f1dSLionel Sambuc // TASK DIRECTIVE
1749*0a6a1f1dSLionel Sambuc #pragma omp task
1750*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
1751*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
1752*0a6a1f1dSLionel Sambuc     ;
1753*0a6a1f1dSLionel Sambuc #pragma omp task
1754*0a6a1f1dSLionel Sambuc #pragma omp simd
1755*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
1756*0a6a1f1dSLionel Sambuc     ;
1757*0a6a1f1dSLionel Sambuc #pragma omp task
1758*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
1759*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
1760*0a6a1f1dSLionel Sambuc     ;
1761*0a6a1f1dSLionel Sambuc #pragma omp task
1762*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
1763*0a6a1f1dSLionel Sambuc   {
1764*0a6a1f1dSLionel Sambuc     bar();
1765*0a6a1f1dSLionel Sambuc   }
1766*0a6a1f1dSLionel Sambuc #pragma omp task
1767*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a task region}}
1768*0a6a1f1dSLionel Sambuc   {
1769*0a6a1f1dSLionel Sambuc     bar();
1770*0a6a1f1dSLionel Sambuc   }
1771*0a6a1f1dSLionel Sambuc #pragma omp task
1772*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
1773*0a6a1f1dSLionel Sambuc   bar();
1774*0a6a1f1dSLionel Sambuc #pragma omp task
1775*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'task' region}}
1776*0a6a1f1dSLionel Sambuc   bar();
1777*0a6a1f1dSLionel Sambuc #pragma omp task
1778*0a6a1f1dSLionel Sambuc #pragma omp critical
1779*0a6a1f1dSLionel Sambuc   bar();
1780*0a6a1f1dSLionel Sambuc 
1781*0a6a1f1dSLionel Sambuc #pragma omp task
1782*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1783*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
1784*0a6a1f1dSLionel Sambuc     ;
1785*0a6a1f1dSLionel Sambuc #pragma omp task
1786*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1787*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
1788*0a6a1f1dSLionel Sambuc     ;
1789*0a6a1f1dSLionel Sambuc #pragma omp task
1790*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1791*0a6a1f1dSLionel Sambuc   {
1792*0a6a1f1dSLionel Sambuc     bar();
1793*0a6a1f1dSLionel Sambuc   }
1794*0a6a1f1dSLionel Sambuc #pragma omp task
1795*0a6a1f1dSLionel Sambuc #pragma omp task
1796*0a6a1f1dSLionel Sambuc   {
1797*0a6a1f1dSLionel Sambuc     bar();
1798*0a6a1f1dSLionel Sambuc   }
1799*0a6a1f1dSLionel Sambuc #pragma omp task
1800*0a6a1f1dSLionel Sambuc   {
1801*0a6a1f1dSLionel Sambuc #pragma omp taskyield
1802*0a6a1f1dSLionel Sambuc     bar();
1803*0a6a1f1dSLionel Sambuc   }
1804*0a6a1f1dSLionel Sambuc #pragma omp task
1805*0a6a1f1dSLionel Sambuc   {
1806*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'task' region}}
1807*0a6a1f1dSLionel Sambuc     bar();
1808*0a6a1f1dSLionel Sambuc   }
1809*0a6a1f1dSLionel Sambuc #pragma omp task
1810*0a6a1f1dSLionel Sambuc   {
1811*0a6a1f1dSLionel Sambuc #pragma omp taskwait
1812*0a6a1f1dSLionel Sambuc     bar();
1813*0a6a1f1dSLionel Sambuc   }
1814*0a6a1f1dSLionel Sambuc #pragma omp task
1815*0a6a1f1dSLionel Sambuc   {
1816*0a6a1f1dSLionel Sambuc #pragma omp flush
1817*0a6a1f1dSLionel Sambuc     bar();
1818*0a6a1f1dSLionel Sambuc   }
1819*0a6a1f1dSLionel Sambuc #pragma omp task
1820*0a6a1f1dSLionel Sambuc   {
1821*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
1822*0a6a1f1dSLionel Sambuc     bar();
1823*0a6a1f1dSLionel Sambuc   }
1824*0a6a1f1dSLionel Sambuc #pragma omp task
1825*0a6a1f1dSLionel Sambuc   {
1826*0a6a1f1dSLionel Sambuc #pragma omp atomic
1827*0a6a1f1dSLionel Sambuc     ++a;
1828*0a6a1f1dSLionel Sambuc   }
1829*0a6a1f1dSLionel Sambuc #pragma omp task
1830*0a6a1f1dSLionel Sambuc   {
1831*0a6a1f1dSLionel Sambuc #pragma omp target
1832*0a6a1f1dSLionel Sambuc     ++a;
1833*0a6a1f1dSLionel Sambuc   }
1834*0a6a1f1dSLionel Sambuc #pragma omp task
1835*0a6a1f1dSLionel Sambuc   {
1836*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
1837*0a6a1f1dSLionel Sambuc     ++a;
1838*0a6a1f1dSLionel Sambuc   }
1839*0a6a1f1dSLionel Sambuc 
1840*0a6a1f1dSLionel Sambuc // ORDERED DIRECTIVE
1841*0a6a1f1dSLionel Sambuc #pragma omp ordered
1842*0a6a1f1dSLionel Sambuc   {
1843*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
1844*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1845*0a6a1f1dSLionel Sambuc       ;
1846*0a6a1f1dSLionel Sambuc   }
1847*0a6a1f1dSLionel Sambuc #pragma omp ordered
1848*0a6a1f1dSLionel Sambuc   {
1849*0a6a1f1dSLionel Sambuc #pragma omp simd
1850*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1851*0a6a1f1dSLionel Sambuc       ;
1852*0a6a1f1dSLionel Sambuc   }
1853*0a6a1f1dSLionel Sambuc #pragma omp ordered
1854*0a6a1f1dSLionel Sambuc   {
1855*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
1856*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1857*0a6a1f1dSLionel Sambuc       ;
1858*0a6a1f1dSLionel Sambuc   }
1859*0a6a1f1dSLionel Sambuc #pragma omp ordered
1860*0a6a1f1dSLionel Sambuc   {
1861*0a6a1f1dSLionel Sambuc #pragma omp parallel
1862*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1863*0a6a1f1dSLionel Sambuc       ;
1864*0a6a1f1dSLionel Sambuc   }
1865*0a6a1f1dSLionel Sambuc #pragma omp ordered
1866*0a6a1f1dSLionel Sambuc   {
1867*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
1868*0a6a1f1dSLionel Sambuc     {
1869*0a6a1f1dSLionel Sambuc       bar();
1870*0a6a1f1dSLionel Sambuc     }
1871*0a6a1f1dSLionel Sambuc   }
1872*0a6a1f1dSLionel Sambuc #pragma omp ordered
1873*0a6a1f1dSLionel Sambuc   {
1874*0a6a1f1dSLionel Sambuc #pragma omp master // OK, though second 'ordered' is redundant
1875*0a6a1f1dSLionel Sambuc     {
1876*0a6a1f1dSLionel Sambuc       bar();
1877*0a6a1f1dSLionel Sambuc     }
1878*0a6a1f1dSLionel Sambuc   }
1879*0a6a1f1dSLionel Sambuc #pragma omp ordered
1880*0a6a1f1dSLionel Sambuc   {
1881*0a6a1f1dSLionel Sambuc #pragma omp critical
1882*0a6a1f1dSLionel Sambuc     {
1883*0a6a1f1dSLionel Sambuc       bar();
1884*0a6a1f1dSLionel Sambuc     }
1885*0a6a1f1dSLionel Sambuc   }
1886*0a6a1f1dSLionel Sambuc #pragma omp ordered
1887*0a6a1f1dSLionel Sambuc   {
1888*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
1889*0a6a1f1dSLionel Sambuc     {
1890*0a6a1f1dSLionel Sambuc       bar();
1891*0a6a1f1dSLionel Sambuc     }
1892*0a6a1f1dSLionel Sambuc   }
1893*0a6a1f1dSLionel Sambuc #pragma omp ordered
1894*0a6a1f1dSLionel Sambuc   {
1895*0a6a1f1dSLionel Sambuc #pragma omp parallel for ordered
1896*0a6a1f1dSLionel Sambuc     for (int j = 0; j < 10; ++j) {
1897*0a6a1f1dSLionel Sambuc #pragma omp ordered // OK
1898*0a6a1f1dSLionel Sambuc       {
1899*0a6a1f1dSLionel Sambuc         bar();
1900*0a6a1f1dSLionel Sambuc       }
1901*0a6a1f1dSLionel Sambuc     }
1902*0a6a1f1dSLionel Sambuc   }
1903*0a6a1f1dSLionel Sambuc #pragma omp ordered
1904*0a6a1f1dSLionel Sambuc   {
1905*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd ordered //expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp parallel for simd'}}
1906*0a6a1f1dSLionel Sambuc     for (int j = 0; j < 10; ++j) {
1907*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1908*0a6a1f1dSLionel Sambuc       {
1909*0a6a1f1dSLionel Sambuc         bar();
1910*0a6a1f1dSLionel Sambuc       }
1911*0a6a1f1dSLionel Sambuc     }
1912*0a6a1f1dSLionel Sambuc   }
1913*0a6a1f1dSLionel Sambuc #pragma omp ordered
1914*0a6a1f1dSLionel Sambuc   {
1915*0a6a1f1dSLionel Sambuc #pragma omp parallel for
1916*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1917*0a6a1f1dSLionel Sambuc       ;
1918*0a6a1f1dSLionel Sambuc   }
1919*0a6a1f1dSLionel Sambuc #pragma omp ordered
1920*0a6a1f1dSLionel Sambuc   {
1921*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
1922*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1923*0a6a1f1dSLionel Sambuc       ;
1924*0a6a1f1dSLionel Sambuc   }
1925*0a6a1f1dSLionel Sambuc #pragma omp ordered
1926*0a6a1f1dSLionel Sambuc   {
1927*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
1928*0a6a1f1dSLionel Sambuc     {
1929*0a6a1f1dSLionel Sambuc       bar();
1930*0a6a1f1dSLionel Sambuc     }
1931*0a6a1f1dSLionel Sambuc   }
1932*0a6a1f1dSLionel Sambuc #pragma omp ordered
1933*0a6a1f1dSLionel Sambuc   {
1934*0a6a1f1dSLionel Sambuc #pragma omp task
1935*0a6a1f1dSLionel Sambuc     {
1936*0a6a1f1dSLionel Sambuc       bar();
1937*0a6a1f1dSLionel Sambuc     }
1938*0a6a1f1dSLionel Sambuc   }
1939*0a6a1f1dSLionel Sambuc #pragma omp ordered
1940*0a6a1f1dSLionel Sambuc   {
1941*0a6a1f1dSLionel Sambuc #pragma omp taskyield
1942*0a6a1f1dSLionel Sambuc     bar();
1943*0a6a1f1dSLionel Sambuc   }
1944*0a6a1f1dSLionel Sambuc #pragma omp ordered
1945*0a6a1f1dSLionel Sambuc   {
1946*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'ordered' region}}
1947*0a6a1f1dSLionel Sambuc     bar();
1948*0a6a1f1dSLionel Sambuc   }
1949*0a6a1f1dSLionel Sambuc #pragma omp ordered
1950*0a6a1f1dSLionel Sambuc   {
1951*0a6a1f1dSLionel Sambuc #pragma omp taskwait
1952*0a6a1f1dSLionel Sambuc     bar();
1953*0a6a1f1dSLionel Sambuc   }
1954*0a6a1f1dSLionel Sambuc #pragma omp ordered
1955*0a6a1f1dSLionel Sambuc   {
1956*0a6a1f1dSLionel Sambuc #pragma omp flush
1957*0a6a1f1dSLionel Sambuc     bar();
1958*0a6a1f1dSLionel Sambuc   }
1959*0a6a1f1dSLionel Sambuc #pragma omp ordered
1960*0a6a1f1dSLionel Sambuc   {
1961*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
1962*0a6a1f1dSLionel Sambuc     bar();
1963*0a6a1f1dSLionel Sambuc   }
1964*0a6a1f1dSLionel Sambuc #pragma omp ordered
1965*0a6a1f1dSLionel Sambuc   {
1966*0a6a1f1dSLionel Sambuc #pragma omp atomic
1967*0a6a1f1dSLionel Sambuc     ++a;
1968*0a6a1f1dSLionel Sambuc   }
1969*0a6a1f1dSLionel Sambuc #pragma omp ordered
1970*0a6a1f1dSLionel Sambuc   {
1971*0a6a1f1dSLionel Sambuc #pragma omp target
1972*0a6a1f1dSLionel Sambuc     ++a;
1973*0a6a1f1dSLionel Sambuc   }
1974*0a6a1f1dSLionel Sambuc #pragma omp ordered
1975*0a6a1f1dSLionel Sambuc   {
1976*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
1977*0a6a1f1dSLionel Sambuc     ++a;
1978*0a6a1f1dSLionel Sambuc   }
1979*0a6a1f1dSLionel Sambuc 
1980*0a6a1f1dSLionel Sambuc // ATOMIC DIRECTIVE
1981*0a6a1f1dSLionel Sambuc #pragma omp atomic
1982*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
1983*0a6a1f1dSLionel Sambuc   {
1984*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
1985*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1986*0a6a1f1dSLionel Sambuc       ;
1987*0a6a1f1dSLionel Sambuc   }
1988*0a6a1f1dSLionel Sambuc #pragma omp atomic
1989*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
1990*0a6a1f1dSLionel Sambuc   {
1991*0a6a1f1dSLionel Sambuc #pragma omp simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
1992*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
1993*0a6a1f1dSLionel Sambuc       ;
1994*0a6a1f1dSLionel Sambuc   }
1995*0a6a1f1dSLionel Sambuc #pragma omp atomic
1996*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
1997*0a6a1f1dSLionel Sambuc   {
1998*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
1999*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2000*0a6a1f1dSLionel Sambuc       ;
2001*0a6a1f1dSLionel Sambuc   }
2002*0a6a1f1dSLionel Sambuc #pragma omp atomic
2003*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2004*0a6a1f1dSLionel Sambuc   {
2005*0a6a1f1dSLionel Sambuc #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2006*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2007*0a6a1f1dSLionel Sambuc       ;
2008*0a6a1f1dSLionel Sambuc   }
2009*0a6a1f1dSLionel Sambuc #pragma omp atomic
2010*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2011*0a6a1f1dSLionel Sambuc   {
2012*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2013*0a6a1f1dSLionel Sambuc     {
2014*0a6a1f1dSLionel Sambuc       bar();
2015*0a6a1f1dSLionel Sambuc     }
2016*0a6a1f1dSLionel Sambuc   }
2017*0a6a1f1dSLionel Sambuc #pragma omp atomic
2018*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2019*0a6a1f1dSLionel Sambuc   {
2020*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2021*0a6a1f1dSLionel Sambuc     {
2022*0a6a1f1dSLionel Sambuc       bar();
2023*0a6a1f1dSLionel Sambuc     }
2024*0a6a1f1dSLionel Sambuc   }
2025*0a6a1f1dSLionel Sambuc #pragma omp atomic
2026*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2027*0a6a1f1dSLionel Sambuc   {
2028*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2029*0a6a1f1dSLionel Sambuc     {
2030*0a6a1f1dSLionel Sambuc       bar();
2031*0a6a1f1dSLionel Sambuc     }
2032*0a6a1f1dSLionel Sambuc   }
2033*0a6a1f1dSLionel Sambuc #pragma omp atomic
2034*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2035*0a6a1f1dSLionel Sambuc   {
2036*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2037*0a6a1f1dSLionel Sambuc     {
2038*0a6a1f1dSLionel Sambuc       bar();
2039*0a6a1f1dSLionel Sambuc     }
2040*0a6a1f1dSLionel Sambuc   }
2041*0a6a1f1dSLionel Sambuc #pragma omp atomic
2042*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2043*0a6a1f1dSLionel Sambuc   {
2044*0a6a1f1dSLionel Sambuc #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2045*0a6a1f1dSLionel Sambuc     {
2046*0a6a1f1dSLionel Sambuc       bar();
2047*0a6a1f1dSLionel Sambuc     }
2048*0a6a1f1dSLionel Sambuc   }
2049*0a6a1f1dSLionel Sambuc #pragma omp atomic
2050*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2051*0a6a1f1dSLionel Sambuc   {
2052*0a6a1f1dSLionel Sambuc #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2053*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2054*0a6a1f1dSLionel Sambuc       ;
2055*0a6a1f1dSLionel Sambuc   }
2056*0a6a1f1dSLionel Sambuc #pragma omp atomic
2057*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2058*0a6a1f1dSLionel Sambuc   {
2059*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2060*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2061*0a6a1f1dSLionel Sambuc       ;
2062*0a6a1f1dSLionel Sambuc   }
2063*0a6a1f1dSLionel Sambuc #pragma omp atomic
2064*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2065*0a6a1f1dSLionel Sambuc   {
2066*0a6a1f1dSLionel Sambuc #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2067*0a6a1f1dSLionel Sambuc     {
2068*0a6a1f1dSLionel Sambuc       bar();
2069*0a6a1f1dSLionel Sambuc     }
2070*0a6a1f1dSLionel Sambuc   }
2071*0a6a1f1dSLionel Sambuc #pragma omp atomic
2072*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2073*0a6a1f1dSLionel Sambuc   {
2074*0a6a1f1dSLionel Sambuc #pragma omp task // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2075*0a6a1f1dSLionel Sambuc     {
2076*0a6a1f1dSLionel Sambuc       bar();
2077*0a6a1f1dSLionel Sambuc     }
2078*0a6a1f1dSLionel Sambuc   }
2079*0a6a1f1dSLionel Sambuc #pragma omp atomic
2080*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2081*0a6a1f1dSLionel Sambuc   {
2082*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2083*0a6a1f1dSLionel Sambuc     bar();
2084*0a6a1f1dSLionel Sambuc   }
2085*0a6a1f1dSLionel Sambuc #pragma omp atomic
2086*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2087*0a6a1f1dSLionel Sambuc   {
2088*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2089*0a6a1f1dSLionel Sambuc     bar();
2090*0a6a1f1dSLionel Sambuc   }
2091*0a6a1f1dSLionel Sambuc #pragma omp atomic
2092*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2093*0a6a1f1dSLionel Sambuc   {
2094*0a6a1f1dSLionel Sambuc #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2095*0a6a1f1dSLionel Sambuc     bar();
2096*0a6a1f1dSLionel Sambuc   }
2097*0a6a1f1dSLionel Sambuc #pragma omp atomic
2098*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2099*0a6a1f1dSLionel Sambuc   {
2100*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2101*0a6a1f1dSLionel Sambuc     bar();
2102*0a6a1f1dSLionel Sambuc   }
2103*0a6a1f1dSLionel Sambuc #pragma omp atomic
2104*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2105*0a6a1f1dSLionel Sambuc   {
2106*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2107*0a6a1f1dSLionel Sambuc     bar();
2108*0a6a1f1dSLionel Sambuc   }
2109*0a6a1f1dSLionel Sambuc #pragma omp atomic
2110*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2111*0a6a1f1dSLionel Sambuc   {
2112*0a6a1f1dSLionel Sambuc #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2113*0a6a1f1dSLionel Sambuc     ++a;
2114*0a6a1f1dSLionel Sambuc   }
2115*0a6a1f1dSLionel Sambuc #pragma omp atomic
2116*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2117*0a6a1f1dSLionel Sambuc   {
2118*0a6a1f1dSLionel Sambuc #pragma omp target // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2119*0a6a1f1dSLionel Sambuc     ++a;
2120*0a6a1f1dSLionel Sambuc   }
2121*0a6a1f1dSLionel Sambuc #pragma omp atomic
2122*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
2123*0a6a1f1dSLionel Sambuc   {
2124*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
2125*0a6a1f1dSLionel Sambuc     ++a;
2126*0a6a1f1dSLionel Sambuc   }
2127*0a6a1f1dSLionel Sambuc 
2128*0a6a1f1dSLionel Sambuc // TARGET DIRECTIVE
2129*0a6a1f1dSLionel Sambuc #pragma omp target
2130*0a6a1f1dSLionel Sambuc #pragma omp parallel
2131*0a6a1f1dSLionel Sambuc   bar();
2132*0a6a1f1dSLionel Sambuc #pragma omp target
2133*0a6a1f1dSLionel Sambuc #pragma omp for
2134*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2135*0a6a1f1dSLionel Sambuc     ;
2136*0a6a1f1dSLionel Sambuc #pragma omp target
2137*0a6a1f1dSLionel Sambuc #pragma omp simd
2138*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2139*0a6a1f1dSLionel Sambuc     ;
2140*0a6a1f1dSLionel Sambuc #pragma omp target
2141*0a6a1f1dSLionel Sambuc #pragma omp for simd
2142*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2143*0a6a1f1dSLionel Sambuc     ;
2144*0a6a1f1dSLionel Sambuc #pragma omp target
2145*0a6a1f1dSLionel Sambuc #pragma omp sections
2146*0a6a1f1dSLionel Sambuc   {
2147*0a6a1f1dSLionel Sambuc     bar();
2148*0a6a1f1dSLionel Sambuc   }
2149*0a6a1f1dSLionel Sambuc #pragma omp target
2150*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target region}}
2151*0a6a1f1dSLionel Sambuc   {
2152*0a6a1f1dSLionel Sambuc     bar();
2153*0a6a1f1dSLionel Sambuc   }
2154*0a6a1f1dSLionel Sambuc #pragma omp target
2155*0a6a1f1dSLionel Sambuc #pragma omp single
2156*0a6a1f1dSLionel Sambuc   bar();
2157*0a6a1f1dSLionel Sambuc 
2158*0a6a1f1dSLionel Sambuc #pragma omp target
2159*0a6a1f1dSLionel Sambuc #pragma omp master
2160*0a6a1f1dSLionel Sambuc   {
2161*0a6a1f1dSLionel Sambuc     bar();
2162*0a6a1f1dSLionel Sambuc   }
2163*0a6a1f1dSLionel Sambuc #pragma omp target
2164*0a6a1f1dSLionel Sambuc #pragma omp critical
2165*0a6a1f1dSLionel Sambuc   {
2166*0a6a1f1dSLionel Sambuc     bar();
2167*0a6a1f1dSLionel Sambuc   }
2168*0a6a1f1dSLionel Sambuc #pragma omp target
2169*0a6a1f1dSLionel Sambuc #pragma omp parallel for
2170*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2171*0a6a1f1dSLionel Sambuc     ;
2172*0a6a1f1dSLionel Sambuc #pragma omp target
2173*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
2174*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2175*0a6a1f1dSLionel Sambuc     ;
2176*0a6a1f1dSLionel Sambuc #pragma omp target
2177*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
2178*0a6a1f1dSLionel Sambuc   {
2179*0a6a1f1dSLionel Sambuc     bar();
2180*0a6a1f1dSLionel Sambuc   }
2181*0a6a1f1dSLionel Sambuc #pragma omp target
2182*0a6a1f1dSLionel Sambuc #pragma omp task
2183*0a6a1f1dSLionel Sambuc   {
2184*0a6a1f1dSLionel Sambuc     bar();
2185*0a6a1f1dSLionel Sambuc   }
2186*0a6a1f1dSLionel Sambuc #pragma omp target
2187*0a6a1f1dSLionel Sambuc   {
2188*0a6a1f1dSLionel Sambuc #pragma omp taskyield
2189*0a6a1f1dSLionel Sambuc     bar();
2190*0a6a1f1dSLionel Sambuc   }
2191*0a6a1f1dSLionel Sambuc #pragma omp target
2192*0a6a1f1dSLionel Sambuc   {
2193*0a6a1f1dSLionel Sambuc #pragma omp barrier
2194*0a6a1f1dSLionel Sambuc     bar();
2195*0a6a1f1dSLionel Sambuc   }
2196*0a6a1f1dSLionel Sambuc #pragma omp target
2197*0a6a1f1dSLionel Sambuc   {
2198*0a6a1f1dSLionel Sambuc #pragma omp taskwait
2199*0a6a1f1dSLionel Sambuc     bar();
2200*0a6a1f1dSLionel Sambuc   }
2201*0a6a1f1dSLionel Sambuc #pragma omp target
2202*0a6a1f1dSLionel Sambuc   {
2203*0a6a1f1dSLionel Sambuc #pragma omp flush
2204*0a6a1f1dSLionel Sambuc     bar();
2205*0a6a1f1dSLionel Sambuc   }
2206*0a6a1f1dSLionel Sambuc #pragma omp target
2207*0a6a1f1dSLionel Sambuc   {
2208*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
2209*0a6a1f1dSLionel Sambuc     bar();
2210*0a6a1f1dSLionel Sambuc   }
2211*0a6a1f1dSLionel Sambuc #pragma omp target
2212*0a6a1f1dSLionel Sambuc   {
2213*0a6a1f1dSLionel Sambuc #pragma omp atomic
2214*0a6a1f1dSLionel Sambuc     ++a;
2215*0a6a1f1dSLionel Sambuc   }
2216*0a6a1f1dSLionel Sambuc #pragma omp target
2217*0a6a1f1dSLionel Sambuc   {
2218*0a6a1f1dSLionel Sambuc #pragma omp target
2219*0a6a1f1dSLionel Sambuc     ++a;
2220*0a6a1f1dSLionel Sambuc   }
2221*0a6a1f1dSLionel Sambuc #pragma omp target
2222*0a6a1f1dSLionel Sambuc   {
2223*0a6a1f1dSLionel Sambuc #pragma omp teams
2224*0a6a1f1dSLionel Sambuc     ++a;
2225*0a6a1f1dSLionel Sambuc   }
2226*0a6a1f1dSLionel Sambuc #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
2227*0a6a1f1dSLionel Sambuc   {
2228*0a6a1f1dSLionel Sambuc     ++a;           // expected-note {{statement outside teams construct here}}
2229*0a6a1f1dSLionel Sambuc #pragma omp teams  // expected-note {{nested teams construct here}}
2230*0a6a1f1dSLionel Sambuc     ++a;
2231*0a6a1f1dSLionel Sambuc   }
2232*0a6a1f1dSLionel Sambuc 
2233*0a6a1f1dSLionel Sambuc // TEAMS DIRECTIVE
2234*0a6a1f1dSLionel Sambuc #pragma omp target
2235*0a6a1f1dSLionel Sambuc #pragma omp teams
2236*0a6a1f1dSLionel Sambuc #pragma omp parallel
2237*0a6a1f1dSLionel Sambuc   bar();
2238*0a6a1f1dSLionel Sambuc #pragma omp target
2239*0a6a1f1dSLionel Sambuc #pragma omp teams
2240*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
2241*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2242*0a6a1f1dSLionel Sambuc     ;
2243*0a6a1f1dSLionel Sambuc #pragma omp target
2244*0a6a1f1dSLionel Sambuc #pragma omp teams
2245*0a6a1f1dSLionel Sambuc #pragma omp simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp simd' directive into a parallel region?}}
2246*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2247*0a6a1f1dSLionel Sambuc     ;
2248*0a6a1f1dSLionel Sambuc #pragma omp target
2249*0a6a1f1dSLionel Sambuc #pragma omp teams
2250*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
2251*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2252*0a6a1f1dSLionel Sambuc     ;
2253*0a6a1f1dSLionel Sambuc #pragma omp target
2254*0a6a1f1dSLionel Sambuc #pragma omp teams
2255*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
2256*0a6a1f1dSLionel Sambuc   {
2257*0a6a1f1dSLionel Sambuc     bar();
2258*0a6a1f1dSLionel Sambuc   }
2259*0a6a1f1dSLionel Sambuc #pragma omp target
2260*0a6a1f1dSLionel Sambuc #pragma omp teams
2261*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams region}}
2262*0a6a1f1dSLionel Sambuc   {
2263*0a6a1f1dSLionel Sambuc     bar();
2264*0a6a1f1dSLionel Sambuc   }
2265*0a6a1f1dSLionel Sambuc #pragma omp target
2266*0a6a1f1dSLionel Sambuc #pragma omp teams
2267*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
2268*0a6a1f1dSLionel Sambuc   bar();
2269*0a6a1f1dSLionel Sambuc 
2270*0a6a1f1dSLionel Sambuc #pragma omp target
2271*0a6a1f1dSLionel Sambuc #pragma omp teams
2272*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp master' directive into a parallel region?}}
2273*0a6a1f1dSLionel Sambuc   {
2274*0a6a1f1dSLionel Sambuc     bar();
2275*0a6a1f1dSLionel Sambuc   }
2276*0a6a1f1dSLionel Sambuc #pragma omp target
2277*0a6a1f1dSLionel Sambuc #pragma omp teams
2278*0a6a1f1dSLionel Sambuc #pragma omp critical // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp critical' directive into a parallel region?}}
2279*0a6a1f1dSLionel Sambuc   {
2280*0a6a1f1dSLionel Sambuc     bar();
2281*0a6a1f1dSLionel Sambuc   }
2282*0a6a1f1dSLionel Sambuc #pragma omp target
2283*0a6a1f1dSLionel Sambuc #pragma omp teams
2284*0a6a1f1dSLionel Sambuc #pragma omp parallel for
2285*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2286*0a6a1f1dSLionel Sambuc     ;
2287*0a6a1f1dSLionel Sambuc #pragma omp target
2288*0a6a1f1dSLionel Sambuc #pragma omp teams
2289*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
2290*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2291*0a6a1f1dSLionel Sambuc     ;
2292*0a6a1f1dSLionel Sambuc #pragma omp target
2293*0a6a1f1dSLionel Sambuc #pragma omp teams
2294*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
2295*0a6a1f1dSLionel Sambuc   {
2296*0a6a1f1dSLionel Sambuc     bar();
2297*0a6a1f1dSLionel Sambuc   }
2298*0a6a1f1dSLionel Sambuc #pragma omp target
2299*0a6a1f1dSLionel Sambuc #pragma omp teams
2300*0a6a1f1dSLionel Sambuc #pragma omp task // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp task' directive into a parallel region?}}
2301*0a6a1f1dSLionel Sambuc   {
2302*0a6a1f1dSLionel Sambuc     bar();
2303*0a6a1f1dSLionel Sambuc   }
2304*0a6a1f1dSLionel Sambuc #pragma omp target
2305*0a6a1f1dSLionel Sambuc #pragma omp teams
2306*0a6a1f1dSLionel Sambuc   {
2307*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskyield' directive into a parallel region?}}
2308*0a6a1f1dSLionel Sambuc     bar();
2309*0a6a1f1dSLionel Sambuc   }
2310*0a6a1f1dSLionel Sambuc #pragma omp target
2311*0a6a1f1dSLionel Sambuc #pragma omp teams
2312*0a6a1f1dSLionel Sambuc   {
2313*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp barrier' directive into a parallel region?}}
2314*0a6a1f1dSLionel Sambuc     bar();
2315*0a6a1f1dSLionel Sambuc   }
2316*0a6a1f1dSLionel Sambuc #pragma omp target
2317*0a6a1f1dSLionel Sambuc #pragma omp teams
2318*0a6a1f1dSLionel Sambuc   {
2319*0a6a1f1dSLionel Sambuc #pragma omp taskwait // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskwait' directive into a parallel region?}}
2320*0a6a1f1dSLionel Sambuc     bar();
2321*0a6a1f1dSLionel Sambuc   }
2322*0a6a1f1dSLionel Sambuc #pragma omp target
2323*0a6a1f1dSLionel Sambuc #pragma omp teams
2324*0a6a1f1dSLionel Sambuc   {
2325*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp flush' directive into a parallel region?}}
2326*0a6a1f1dSLionel Sambuc     bar();
2327*0a6a1f1dSLionel Sambuc   }
2328*0a6a1f1dSLionel Sambuc #pragma omp target
2329*0a6a1f1dSLionel Sambuc #pragma omp teams
2330*0a6a1f1dSLionel Sambuc   {
2331*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
2332*0a6a1f1dSLionel Sambuc     bar();
2333*0a6a1f1dSLionel Sambuc   }
2334*0a6a1f1dSLionel Sambuc #pragma omp target
2335*0a6a1f1dSLionel Sambuc #pragma omp teams
2336*0a6a1f1dSLionel Sambuc   {
2337*0a6a1f1dSLionel Sambuc #pragma omp atomic // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp atomic' directive into a parallel region?}}
2338*0a6a1f1dSLionel Sambuc     ++a;
2339*0a6a1f1dSLionel Sambuc   }
2340*0a6a1f1dSLionel Sambuc #pragma omp target
2341*0a6a1f1dSLionel Sambuc #pragma omp teams
2342*0a6a1f1dSLionel Sambuc   {
2343*0a6a1f1dSLionel Sambuc #pragma omp target // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp target' directive into a parallel region?}}
2344*0a6a1f1dSLionel Sambuc     ++a;
2345*0a6a1f1dSLionel Sambuc   }
2346*0a6a1f1dSLionel Sambuc #pragma omp target
2347*0a6a1f1dSLionel Sambuc #pragma omp teams
2348*0a6a1f1dSLionel Sambuc   {
2349*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
2350*0a6a1f1dSLionel Sambuc     ++a;
2351*0a6a1f1dSLionel Sambuc   }
2352*0a6a1f1dSLionel Sambuc }
2353*0a6a1f1dSLionel Sambuc 
foo()2354*0a6a1f1dSLionel Sambuc void foo() {
2355*0a6a1f1dSLionel Sambuc   int a = 0;
2356*0a6a1f1dSLionel Sambuc // PARALLEL DIRECTIVE
2357*0a6a1f1dSLionel Sambuc #pragma omp parallel
2358*0a6a1f1dSLionel Sambuc #pragma omp for
2359*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2360*0a6a1f1dSLionel Sambuc     ;
2361*0a6a1f1dSLionel Sambuc #pragma omp parallel
2362*0a6a1f1dSLionel Sambuc #pragma omp simd
2363*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2364*0a6a1f1dSLionel Sambuc     ;
2365*0a6a1f1dSLionel Sambuc #pragma omp parallel
2366*0a6a1f1dSLionel Sambuc #pragma omp for simd
2367*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2368*0a6a1f1dSLionel Sambuc     ;
2369*0a6a1f1dSLionel Sambuc #pragma omp parallel
2370*0a6a1f1dSLionel Sambuc #pragma omp sections
2371*0a6a1f1dSLionel Sambuc   {
2372*0a6a1f1dSLionel Sambuc     bar();
2373*0a6a1f1dSLionel Sambuc   }
2374*0a6a1f1dSLionel Sambuc #pragma omp parallel
2375*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel region}}
2376*0a6a1f1dSLionel Sambuc   {
2377*0a6a1f1dSLionel Sambuc     bar();
2378*0a6a1f1dSLionel Sambuc   }
2379*0a6a1f1dSLionel Sambuc #pragma omp parallel
2380*0a6a1f1dSLionel Sambuc #pragma omp sections
2381*0a6a1f1dSLionel Sambuc   {
2382*0a6a1f1dSLionel Sambuc     bar();
2383*0a6a1f1dSLionel Sambuc   }
2384*0a6a1f1dSLionel Sambuc #pragma omp parallel
2385*0a6a1f1dSLionel Sambuc #pragma omp single
2386*0a6a1f1dSLionel Sambuc   bar();
2387*0a6a1f1dSLionel Sambuc #pragma omp parallel
2388*0a6a1f1dSLionel Sambuc #pragma omp master
2389*0a6a1f1dSLionel Sambuc   bar();
2390*0a6a1f1dSLionel Sambuc #pragma omp parallel
2391*0a6a1f1dSLionel Sambuc #pragma omp critical
2392*0a6a1f1dSLionel Sambuc   bar();
2393*0a6a1f1dSLionel Sambuc #pragma omp parallel
2394*0a6a1f1dSLionel Sambuc #pragma omp parallel for
2395*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2396*0a6a1f1dSLionel Sambuc     ;
2397*0a6a1f1dSLionel Sambuc #pragma omp parallel
2398*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
2399*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
2400*0a6a1f1dSLionel Sambuc     ;
2401*0a6a1f1dSLionel Sambuc #pragma omp parallel
2402*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
2403*0a6a1f1dSLionel Sambuc   {
2404*0a6a1f1dSLionel Sambuc     bar();
2405*0a6a1f1dSLionel Sambuc   }
2406*0a6a1f1dSLionel Sambuc #pragma omp parallel
2407*0a6a1f1dSLionel Sambuc #pragma omp task
2408*0a6a1f1dSLionel Sambuc   {
2409*0a6a1f1dSLionel Sambuc     bar();
2410*0a6a1f1dSLionel Sambuc   }
2411*0a6a1f1dSLionel Sambuc #pragma omp parallel
2412*0a6a1f1dSLionel Sambuc   {
2413*0a6a1f1dSLionel Sambuc #pragma omp taskyield
2414*0a6a1f1dSLionel Sambuc     bar();
2415*0a6a1f1dSLionel Sambuc   }
2416*0a6a1f1dSLionel Sambuc #pragma omp parallel
2417*0a6a1f1dSLionel Sambuc   {
2418*0a6a1f1dSLionel Sambuc #pragma omp barrier
2419*0a6a1f1dSLionel Sambuc     bar();
2420*0a6a1f1dSLionel Sambuc   }
2421*0a6a1f1dSLionel Sambuc #pragma omp parallel
2422*0a6a1f1dSLionel Sambuc   {
2423*0a6a1f1dSLionel Sambuc #pragma omp taskwait
2424*0a6a1f1dSLionel Sambuc     bar();
2425*0a6a1f1dSLionel Sambuc   }
2426*0a6a1f1dSLionel Sambuc #pragma omp parallel
2427*0a6a1f1dSLionel Sambuc   {
2428*0a6a1f1dSLionel Sambuc #pragma omp flush
2429*0a6a1f1dSLionel Sambuc     bar();
2430*0a6a1f1dSLionel Sambuc   }
2431*0a6a1f1dSLionel Sambuc #pragma omp parallel
2432*0a6a1f1dSLionel Sambuc   {
2433*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
2434*0a6a1f1dSLionel Sambuc     bar();
2435*0a6a1f1dSLionel Sambuc   }
2436*0a6a1f1dSLionel Sambuc #pragma omp parallel
2437*0a6a1f1dSLionel Sambuc   {
2438*0a6a1f1dSLionel Sambuc #pragma omp atomic
2439*0a6a1f1dSLionel Sambuc     ++a;
2440*0a6a1f1dSLionel Sambuc   }
2441*0a6a1f1dSLionel Sambuc #pragma omp parallel
2442*0a6a1f1dSLionel Sambuc   {
2443*0a6a1f1dSLionel Sambuc #pragma omp target
2444*0a6a1f1dSLionel Sambuc     ++a;
2445*0a6a1f1dSLionel Sambuc   }
2446*0a6a1f1dSLionel Sambuc #pragma omp parallel
2447*0a6a1f1dSLionel Sambuc   {
2448*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
2449*0a6a1f1dSLionel Sambuc     ++a;
2450*0a6a1f1dSLionel Sambuc   }
2451*0a6a1f1dSLionel Sambuc 
2452*0a6a1f1dSLionel Sambuc // SIMD DIRECTIVE
2453*0a6a1f1dSLionel Sambuc #pragma omp simd
2454*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2455*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2456*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2457*0a6a1f1dSLionel Sambuc       ;
2458*0a6a1f1dSLionel Sambuc   }
2459*0a6a1f1dSLionel Sambuc #pragma omp simd
2460*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2461*0a6a1f1dSLionel Sambuc #pragma omp simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2462*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2463*0a6a1f1dSLionel Sambuc       ;
2464*0a6a1f1dSLionel Sambuc   }
2465*0a6a1f1dSLionel Sambuc #pragma omp simd
2466*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2467*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2468*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2469*0a6a1f1dSLionel Sambuc       ;
2470*0a6a1f1dSLionel Sambuc   }
2471*0a6a1f1dSLionel Sambuc #pragma omp simd
2472*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2473*0a6a1f1dSLionel Sambuc #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2474*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2475*0a6a1f1dSLionel Sambuc       ;
2476*0a6a1f1dSLionel Sambuc   }
2477*0a6a1f1dSLionel Sambuc #pragma omp simd
2478*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2479*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2480*0a6a1f1dSLionel Sambuc     {
2481*0a6a1f1dSLionel Sambuc       bar();
2482*0a6a1f1dSLionel Sambuc     }
2483*0a6a1f1dSLionel Sambuc   }
2484*0a6a1f1dSLionel Sambuc #pragma omp simd
2485*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2486*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2487*0a6a1f1dSLionel Sambuc     {
2488*0a6a1f1dSLionel Sambuc       bar();
2489*0a6a1f1dSLionel Sambuc     }
2490*0a6a1f1dSLionel Sambuc   }
2491*0a6a1f1dSLionel Sambuc #pragma omp simd
2492*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2493*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2494*0a6a1f1dSLionel Sambuc     bar();
2495*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2496*0a6a1f1dSLionel Sambuc     bar();
2497*0a6a1f1dSLionel Sambuc   }
2498*0a6a1f1dSLionel Sambuc #pragma omp simd
2499*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2500*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2501*0a6a1f1dSLionel Sambuc     bar();
2502*0a6a1f1dSLionel Sambuc #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2503*0a6a1f1dSLionel Sambuc     bar();
2504*0a6a1f1dSLionel Sambuc   }
2505*0a6a1f1dSLionel Sambuc #pragma omp simd
2506*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2507*0a6a1f1dSLionel Sambuc #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2508*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2509*0a6a1f1dSLionel Sambuc       ;
2510*0a6a1f1dSLionel Sambuc   }
2511*0a6a1f1dSLionel Sambuc #pragma omp simd
2512*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2513*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2514*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2515*0a6a1f1dSLionel Sambuc       ;
2516*0a6a1f1dSLionel Sambuc   }
2517*0a6a1f1dSLionel Sambuc #pragma omp simd
2518*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2519*0a6a1f1dSLionel Sambuc #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2520*0a6a1f1dSLionel Sambuc     {
2521*0a6a1f1dSLionel Sambuc       bar();
2522*0a6a1f1dSLionel Sambuc     }
2523*0a6a1f1dSLionel Sambuc   }
2524*0a6a1f1dSLionel Sambuc #pragma omp simd
2525*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2526*0a6a1f1dSLionel Sambuc #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2527*0a6a1f1dSLionel Sambuc     {
2528*0a6a1f1dSLionel Sambuc       bar();
2529*0a6a1f1dSLionel Sambuc     }
2530*0a6a1f1dSLionel Sambuc   }
2531*0a6a1f1dSLionel Sambuc #pragma omp simd
2532*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2533*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2534*0a6a1f1dSLionel Sambuc     bar();
2535*0a6a1f1dSLionel Sambuc   }
2536*0a6a1f1dSLionel Sambuc #pragma omp simd
2537*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2538*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2539*0a6a1f1dSLionel Sambuc     bar();
2540*0a6a1f1dSLionel Sambuc   }
2541*0a6a1f1dSLionel Sambuc #pragma omp simd
2542*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2543*0a6a1f1dSLionel Sambuc #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2544*0a6a1f1dSLionel Sambuc     bar();
2545*0a6a1f1dSLionel Sambuc   }
2546*0a6a1f1dSLionel Sambuc #pragma omp simd
2547*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2548*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2549*0a6a1f1dSLionel Sambuc     bar();
2550*0a6a1f1dSLionel Sambuc   }
2551*0a6a1f1dSLionel Sambuc #pragma omp simd
2552*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2553*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2554*0a6a1f1dSLionel Sambuc     bar();
2555*0a6a1f1dSLionel Sambuc   }
2556*0a6a1f1dSLionel Sambuc #pragma omp simd
2557*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2558*0a6a1f1dSLionel Sambuc #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2559*0a6a1f1dSLionel Sambuc     ++a;
2560*0a6a1f1dSLionel Sambuc   }
2561*0a6a1f1dSLionel Sambuc #pragma omp simd
2562*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2563*0a6a1f1dSLionel Sambuc #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2564*0a6a1f1dSLionel Sambuc     ++a;
2565*0a6a1f1dSLionel Sambuc   }
2566*0a6a1f1dSLionel Sambuc #pragma omp simd
2567*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2568*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2569*0a6a1f1dSLionel Sambuc     ++a;
2570*0a6a1f1dSLionel Sambuc   }
2571*0a6a1f1dSLionel Sambuc 
2572*0a6a1f1dSLionel Sambuc // FOR DIRECTIVE
2573*0a6a1f1dSLionel Sambuc #pragma omp for
2574*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2575*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
2576*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2577*0a6a1f1dSLionel Sambuc       ;
2578*0a6a1f1dSLionel Sambuc   }
2579*0a6a1f1dSLionel Sambuc #pragma omp for
2580*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2581*0a6a1f1dSLionel Sambuc #pragma omp simd
2582*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2583*0a6a1f1dSLionel Sambuc       ;
2584*0a6a1f1dSLionel Sambuc   }
2585*0a6a1f1dSLionel Sambuc #pragma omp for
2586*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2587*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
2588*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2589*0a6a1f1dSLionel Sambuc       ;
2590*0a6a1f1dSLionel Sambuc   }
2591*0a6a1f1dSLionel Sambuc #pragma omp for
2592*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2593*0a6a1f1dSLionel Sambuc #pragma omp parallel
2594*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2595*0a6a1f1dSLionel Sambuc       ;
2596*0a6a1f1dSLionel Sambuc   }
2597*0a6a1f1dSLionel Sambuc #pragma omp for
2598*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2599*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
2600*0a6a1f1dSLionel Sambuc     {
2601*0a6a1f1dSLionel Sambuc       bar();
2602*0a6a1f1dSLionel Sambuc     }
2603*0a6a1f1dSLionel Sambuc   }
2604*0a6a1f1dSLionel Sambuc #pragma omp for
2605*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2606*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a for region}}
2607*0a6a1f1dSLionel Sambuc     {
2608*0a6a1f1dSLionel Sambuc       bar();
2609*0a6a1f1dSLionel Sambuc     }
2610*0a6a1f1dSLionel Sambuc   }
2611*0a6a1f1dSLionel Sambuc #pragma omp for
2612*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2613*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
2614*0a6a1f1dSLionel Sambuc     bar();
2615*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'for' region}}
2616*0a6a1f1dSLionel Sambuc     bar();
2617*0a6a1f1dSLionel Sambuc #pragma omp critical
2618*0a6a1f1dSLionel Sambuc     bar();
2619*0a6a1f1dSLionel Sambuc   }
2620*0a6a1f1dSLionel Sambuc #pragma omp for
2621*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2622*0a6a1f1dSLionel Sambuc #pragma omp parallel
2623*0a6a1f1dSLionel Sambuc     {
2624*0a6a1f1dSLionel Sambuc #pragma omp single // OK
2625*0a6a1f1dSLionel Sambuc       {
2626*0a6a1f1dSLionel Sambuc         bar();
2627*0a6a1f1dSLionel Sambuc       }
2628*0a6a1f1dSLionel Sambuc #pragma omp for // OK
2629*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
2630*0a6a1f1dSLionel Sambuc         ;
2631*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
2632*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
2633*0a6a1f1dSLionel Sambuc         ;
2634*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
2635*0a6a1f1dSLionel Sambuc       {
2636*0a6a1f1dSLionel Sambuc         bar();
2637*0a6a1f1dSLionel Sambuc       }
2638*0a6a1f1dSLionel Sambuc     }
2639*0a6a1f1dSLionel Sambuc   }
2640*0a6a1f1dSLionel Sambuc #pragma omp for
2641*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2642*0a6a1f1dSLionel Sambuc #pragma omp parallel for
2643*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2644*0a6a1f1dSLionel Sambuc       ;
2645*0a6a1f1dSLionel Sambuc   }
2646*0a6a1f1dSLionel Sambuc #pragma omp for
2647*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2648*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
2649*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2650*0a6a1f1dSLionel Sambuc       ;
2651*0a6a1f1dSLionel Sambuc   }
2652*0a6a1f1dSLionel Sambuc #pragma omp for
2653*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2654*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
2655*0a6a1f1dSLionel Sambuc     {
2656*0a6a1f1dSLionel Sambuc       bar();
2657*0a6a1f1dSLionel Sambuc     }
2658*0a6a1f1dSLionel Sambuc   }
2659*0a6a1f1dSLionel Sambuc #pragma omp for
2660*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2661*0a6a1f1dSLionel Sambuc #pragma omp task
2662*0a6a1f1dSLionel Sambuc     {
2663*0a6a1f1dSLionel Sambuc       bar();
2664*0a6a1f1dSLionel Sambuc     }
2665*0a6a1f1dSLionel Sambuc   }
2666*0a6a1f1dSLionel Sambuc #pragma omp for
2667*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2668*0a6a1f1dSLionel Sambuc #pragma omp taskyield
2669*0a6a1f1dSLionel Sambuc     bar();
2670*0a6a1f1dSLionel Sambuc   }
2671*0a6a1f1dSLionel Sambuc #pragma omp for
2672*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2673*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'for' region}}
2674*0a6a1f1dSLionel Sambuc     bar();
2675*0a6a1f1dSLionel Sambuc   }
2676*0a6a1f1dSLionel Sambuc #pragma omp for
2677*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2678*0a6a1f1dSLionel Sambuc #pragma omp taskwait
2679*0a6a1f1dSLionel Sambuc     bar();
2680*0a6a1f1dSLionel Sambuc   }
2681*0a6a1f1dSLionel Sambuc #pragma omp for
2682*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2683*0a6a1f1dSLionel Sambuc #pragma omp flush
2684*0a6a1f1dSLionel Sambuc     bar();
2685*0a6a1f1dSLionel Sambuc   }
2686*0a6a1f1dSLionel Sambuc #pragma omp for
2687*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2688*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
2689*0a6a1f1dSLionel Sambuc     bar();
2690*0a6a1f1dSLionel Sambuc   }
2691*0a6a1f1dSLionel Sambuc #pragma omp for ordered
2692*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2693*0a6a1f1dSLionel Sambuc #pragma omp ordered // OK
2694*0a6a1f1dSLionel Sambuc     bar();
2695*0a6a1f1dSLionel Sambuc   }
2696*0a6a1f1dSLionel Sambuc #pragma omp for
2697*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2698*0a6a1f1dSLionel Sambuc #pragma omp atomic
2699*0a6a1f1dSLionel Sambuc     ++a;
2700*0a6a1f1dSLionel Sambuc   }
2701*0a6a1f1dSLionel Sambuc #pragma omp for
2702*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2703*0a6a1f1dSLionel Sambuc #pragma omp target
2704*0a6a1f1dSLionel Sambuc     ++a;
2705*0a6a1f1dSLionel Sambuc   }
2706*0a6a1f1dSLionel Sambuc #pragma omp for
2707*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2708*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
2709*0a6a1f1dSLionel Sambuc     ++a;
2710*0a6a1f1dSLionel Sambuc   }
2711*0a6a1f1dSLionel Sambuc 
2712*0a6a1f1dSLionel Sambuc // FOR SIMD DIRECTIVE
2713*0a6a1f1dSLionel Sambuc #pragma omp for simd
2714*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2715*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2716*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2717*0a6a1f1dSLionel Sambuc       ;
2718*0a6a1f1dSLionel Sambuc   }
2719*0a6a1f1dSLionel Sambuc #pragma omp for simd
2720*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2721*0a6a1f1dSLionel Sambuc #pragma omp simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2722*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2723*0a6a1f1dSLionel Sambuc       ;
2724*0a6a1f1dSLionel Sambuc   }
2725*0a6a1f1dSLionel Sambuc #pragma omp for simd
2726*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2727*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2728*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2729*0a6a1f1dSLionel Sambuc       ;
2730*0a6a1f1dSLionel Sambuc   }
2731*0a6a1f1dSLionel Sambuc #pragma omp for simd
2732*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2733*0a6a1f1dSLionel Sambuc #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2734*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2735*0a6a1f1dSLionel Sambuc       ;
2736*0a6a1f1dSLionel Sambuc   }
2737*0a6a1f1dSLionel Sambuc #pragma omp for simd
2738*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2739*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2740*0a6a1f1dSLionel Sambuc     {
2741*0a6a1f1dSLionel Sambuc       bar();
2742*0a6a1f1dSLionel Sambuc     }
2743*0a6a1f1dSLionel Sambuc   }
2744*0a6a1f1dSLionel Sambuc #pragma omp for simd
2745*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2746*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2747*0a6a1f1dSLionel Sambuc     {
2748*0a6a1f1dSLionel Sambuc       bar();
2749*0a6a1f1dSLionel Sambuc     }
2750*0a6a1f1dSLionel Sambuc   }
2751*0a6a1f1dSLionel Sambuc #pragma omp for simd
2752*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2753*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2754*0a6a1f1dSLionel Sambuc     bar();
2755*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2756*0a6a1f1dSLionel Sambuc     bar();
2757*0a6a1f1dSLionel Sambuc   }
2758*0a6a1f1dSLionel Sambuc #pragma omp for simd
2759*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2760*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2761*0a6a1f1dSLionel Sambuc     bar();
2762*0a6a1f1dSLionel Sambuc #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2763*0a6a1f1dSLionel Sambuc     bar();
2764*0a6a1f1dSLionel Sambuc   }
2765*0a6a1f1dSLionel Sambuc #pragma omp for simd
2766*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2767*0a6a1f1dSLionel Sambuc #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2768*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2769*0a6a1f1dSLionel Sambuc       ;
2770*0a6a1f1dSLionel Sambuc   }
2771*0a6a1f1dSLionel Sambuc #pragma omp for simd
2772*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2773*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2774*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2775*0a6a1f1dSLionel Sambuc       ;
2776*0a6a1f1dSLionel Sambuc   }
2777*0a6a1f1dSLionel Sambuc #pragma omp for simd
2778*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2779*0a6a1f1dSLionel Sambuc #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2780*0a6a1f1dSLionel Sambuc     {
2781*0a6a1f1dSLionel Sambuc       bar();
2782*0a6a1f1dSLionel Sambuc     }
2783*0a6a1f1dSLionel Sambuc   }
2784*0a6a1f1dSLionel Sambuc #pragma omp for simd
2785*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2786*0a6a1f1dSLionel Sambuc #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2787*0a6a1f1dSLionel Sambuc     {
2788*0a6a1f1dSLionel Sambuc       bar();
2789*0a6a1f1dSLionel Sambuc     }
2790*0a6a1f1dSLionel Sambuc   }
2791*0a6a1f1dSLionel Sambuc #pragma omp for simd
2792*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2793*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2794*0a6a1f1dSLionel Sambuc     bar();
2795*0a6a1f1dSLionel Sambuc   }
2796*0a6a1f1dSLionel Sambuc #pragma omp for simd
2797*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2798*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2799*0a6a1f1dSLionel Sambuc     bar();
2800*0a6a1f1dSLionel Sambuc   }
2801*0a6a1f1dSLionel Sambuc #pragma omp for simd
2802*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2803*0a6a1f1dSLionel Sambuc #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2804*0a6a1f1dSLionel Sambuc     bar();
2805*0a6a1f1dSLionel Sambuc   }
2806*0a6a1f1dSLionel Sambuc #pragma omp for simd
2807*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2808*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2809*0a6a1f1dSLionel Sambuc     bar();
2810*0a6a1f1dSLionel Sambuc   }
2811*0a6a1f1dSLionel Sambuc #pragma omp for simd
2812*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2813*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2814*0a6a1f1dSLionel Sambuc     bar();
2815*0a6a1f1dSLionel Sambuc   }
2816*0a6a1f1dSLionel Sambuc #pragma omp for simd
2817*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2818*0a6a1f1dSLionel Sambuc #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2819*0a6a1f1dSLionel Sambuc     ++a;
2820*0a6a1f1dSLionel Sambuc   }
2821*0a6a1f1dSLionel Sambuc #pragma omp for simd
2822*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2823*0a6a1f1dSLionel Sambuc #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2824*0a6a1f1dSLionel Sambuc     ++a;
2825*0a6a1f1dSLionel Sambuc   }
2826*0a6a1f1dSLionel Sambuc #pragma omp for simd
2827*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
2828*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2829*0a6a1f1dSLionel Sambuc     ++a;
2830*0a6a1f1dSLionel Sambuc   }
2831*0a6a1f1dSLionel Sambuc 
2832*0a6a1f1dSLionel Sambuc // SECTIONS DIRECTIVE
2833*0a6a1f1dSLionel Sambuc #pragma omp sections
2834*0a6a1f1dSLionel Sambuc   {
2835*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
2836*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2837*0a6a1f1dSLionel Sambuc       ;
2838*0a6a1f1dSLionel Sambuc   }
2839*0a6a1f1dSLionel Sambuc #pragma omp sections
2840*0a6a1f1dSLionel Sambuc   {
2841*0a6a1f1dSLionel Sambuc #pragma omp simd
2842*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2843*0a6a1f1dSLionel Sambuc       ;
2844*0a6a1f1dSLionel Sambuc   }
2845*0a6a1f1dSLionel Sambuc #pragma omp sections
2846*0a6a1f1dSLionel Sambuc   {
2847*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
2848*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2849*0a6a1f1dSLionel Sambuc       ;
2850*0a6a1f1dSLionel Sambuc   }
2851*0a6a1f1dSLionel Sambuc #pragma omp sections
2852*0a6a1f1dSLionel Sambuc   {
2853*0a6a1f1dSLionel Sambuc #pragma omp parallel
2854*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2855*0a6a1f1dSLionel Sambuc       ;
2856*0a6a1f1dSLionel Sambuc   }
2857*0a6a1f1dSLionel Sambuc #pragma omp sections
2858*0a6a1f1dSLionel Sambuc   {
2859*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
2860*0a6a1f1dSLionel Sambuc     {
2861*0a6a1f1dSLionel Sambuc       bar();
2862*0a6a1f1dSLionel Sambuc     }
2863*0a6a1f1dSLionel Sambuc   }
2864*0a6a1f1dSLionel Sambuc #pragma omp sections
2865*0a6a1f1dSLionel Sambuc   {
2866*0a6a1f1dSLionel Sambuc #pragma omp section
2867*0a6a1f1dSLionel Sambuc     {
2868*0a6a1f1dSLionel Sambuc       bar();
2869*0a6a1f1dSLionel Sambuc     }
2870*0a6a1f1dSLionel Sambuc   }
2871*0a6a1f1dSLionel Sambuc #pragma omp sections
2872*0a6a1f1dSLionel Sambuc   {
2873*0a6a1f1dSLionel Sambuc #pragma omp critical
2874*0a6a1f1dSLionel Sambuc     bar();
2875*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
2876*0a6a1f1dSLionel Sambuc     bar();
2877*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'sections' region}}
2878*0a6a1f1dSLionel Sambuc     bar();
2879*0a6a1f1dSLionel Sambuc   }
2880*0a6a1f1dSLionel Sambuc #pragma omp sections
2881*0a6a1f1dSLionel Sambuc   {
2882*0a6a1f1dSLionel Sambuc #pragma omp parallel
2883*0a6a1f1dSLionel Sambuc     {
2884*0a6a1f1dSLionel Sambuc #pragma omp single // OK
2885*0a6a1f1dSLionel Sambuc       {
2886*0a6a1f1dSLionel Sambuc         bar();
2887*0a6a1f1dSLionel Sambuc       }
2888*0a6a1f1dSLionel Sambuc #pragma omp for // OK
2889*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
2890*0a6a1f1dSLionel Sambuc         ;
2891*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
2892*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
2893*0a6a1f1dSLionel Sambuc         ;
2894*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
2895*0a6a1f1dSLionel Sambuc       {
2896*0a6a1f1dSLionel Sambuc         bar();
2897*0a6a1f1dSLionel Sambuc       }
2898*0a6a1f1dSLionel Sambuc     }
2899*0a6a1f1dSLionel Sambuc   }
2900*0a6a1f1dSLionel Sambuc #pragma omp sections
2901*0a6a1f1dSLionel Sambuc   {
2902*0a6a1f1dSLionel Sambuc #pragma omp parallel for
2903*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2904*0a6a1f1dSLionel Sambuc       ;
2905*0a6a1f1dSLionel Sambuc   }
2906*0a6a1f1dSLionel Sambuc #pragma omp sections
2907*0a6a1f1dSLionel Sambuc   {
2908*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
2909*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
2910*0a6a1f1dSLionel Sambuc       ;
2911*0a6a1f1dSLionel Sambuc   }
2912*0a6a1f1dSLionel Sambuc #pragma omp sections
2913*0a6a1f1dSLionel Sambuc   {
2914*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
2915*0a6a1f1dSLionel Sambuc     {
2916*0a6a1f1dSLionel Sambuc       bar();
2917*0a6a1f1dSLionel Sambuc     }
2918*0a6a1f1dSLionel Sambuc   }
2919*0a6a1f1dSLionel Sambuc #pragma omp sections
2920*0a6a1f1dSLionel Sambuc   {
2921*0a6a1f1dSLionel Sambuc #pragma omp task
2922*0a6a1f1dSLionel Sambuc     {
2923*0a6a1f1dSLionel Sambuc       bar();
2924*0a6a1f1dSLionel Sambuc     }
2925*0a6a1f1dSLionel Sambuc   }
2926*0a6a1f1dSLionel Sambuc #pragma omp sections
2927*0a6a1f1dSLionel Sambuc   {
2928*0a6a1f1dSLionel Sambuc #pragma omp taskyield
2929*0a6a1f1dSLionel Sambuc   }
2930*0a6a1f1dSLionel Sambuc #pragma omp sections
2931*0a6a1f1dSLionel Sambuc   {
2932*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'sections' region}}
2933*0a6a1f1dSLionel Sambuc     bar();
2934*0a6a1f1dSLionel Sambuc   }
2935*0a6a1f1dSLionel Sambuc #pragma omp sections
2936*0a6a1f1dSLionel Sambuc   {
2937*0a6a1f1dSLionel Sambuc #pragma omp taskwait
2938*0a6a1f1dSLionel Sambuc   }
2939*0a6a1f1dSLionel Sambuc #pragma omp sections
2940*0a6a1f1dSLionel Sambuc   {
2941*0a6a1f1dSLionel Sambuc #pragma omp flush
2942*0a6a1f1dSLionel Sambuc   }
2943*0a6a1f1dSLionel Sambuc #pragma omp sections
2944*0a6a1f1dSLionel Sambuc   {
2945*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
2946*0a6a1f1dSLionel Sambuc     bar();
2947*0a6a1f1dSLionel Sambuc   }
2948*0a6a1f1dSLionel Sambuc #pragma omp sections
2949*0a6a1f1dSLionel Sambuc   {
2950*0a6a1f1dSLionel Sambuc #pragma omp atomic
2951*0a6a1f1dSLionel Sambuc     ++a;
2952*0a6a1f1dSLionel Sambuc   }
2953*0a6a1f1dSLionel Sambuc #pragma omp sections
2954*0a6a1f1dSLionel Sambuc   {
2955*0a6a1f1dSLionel Sambuc #pragma omp target
2956*0a6a1f1dSLionel Sambuc     ++a;
2957*0a6a1f1dSLionel Sambuc   }
2958*0a6a1f1dSLionel Sambuc #pragma omp sections
2959*0a6a1f1dSLionel Sambuc   {
2960*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
2961*0a6a1f1dSLionel Sambuc     ++a;
2962*0a6a1f1dSLionel Sambuc   }
2963*0a6a1f1dSLionel Sambuc 
2964*0a6a1f1dSLionel Sambuc // SECTION DIRECTIVE
2965*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}}
2966*0a6a1f1dSLionel Sambuc   {
2967*0a6a1f1dSLionel Sambuc     bar();
2968*0a6a1f1dSLionel Sambuc   }
2969*0a6a1f1dSLionel Sambuc #pragma omp sections
2970*0a6a1f1dSLionel Sambuc   {
2971*0a6a1f1dSLionel Sambuc #pragma omp section
2972*0a6a1f1dSLionel Sambuc     {
2973*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
2974*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
2975*0a6a1f1dSLionel Sambuc         ;
2976*0a6a1f1dSLionel Sambuc     }
2977*0a6a1f1dSLionel Sambuc   }
2978*0a6a1f1dSLionel Sambuc #pragma omp sections
2979*0a6a1f1dSLionel Sambuc   {
2980*0a6a1f1dSLionel Sambuc #pragma omp section
2981*0a6a1f1dSLionel Sambuc     {
2982*0a6a1f1dSLionel Sambuc #pragma omp simd
2983*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
2984*0a6a1f1dSLionel Sambuc         ;
2985*0a6a1f1dSLionel Sambuc     }
2986*0a6a1f1dSLionel Sambuc   }
2987*0a6a1f1dSLionel Sambuc #pragma omp sections
2988*0a6a1f1dSLionel Sambuc   {
2989*0a6a1f1dSLionel Sambuc #pragma omp section
2990*0a6a1f1dSLionel Sambuc     {
2991*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
2992*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
2993*0a6a1f1dSLionel Sambuc         ;
2994*0a6a1f1dSLionel Sambuc     }
2995*0a6a1f1dSLionel Sambuc   }
2996*0a6a1f1dSLionel Sambuc #pragma omp sections
2997*0a6a1f1dSLionel Sambuc   {
2998*0a6a1f1dSLionel Sambuc #pragma omp section
2999*0a6a1f1dSLionel Sambuc     {
3000*0a6a1f1dSLionel Sambuc #pragma omp parallel
3001*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3002*0a6a1f1dSLionel Sambuc         ;
3003*0a6a1f1dSLionel Sambuc     }
3004*0a6a1f1dSLionel Sambuc   }
3005*0a6a1f1dSLionel Sambuc #pragma omp sections
3006*0a6a1f1dSLionel Sambuc   {
3007*0a6a1f1dSLionel Sambuc #pragma omp section
3008*0a6a1f1dSLionel Sambuc     {
3009*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
3010*0a6a1f1dSLionel Sambuc       {
3011*0a6a1f1dSLionel Sambuc         bar();
3012*0a6a1f1dSLionel Sambuc       }
3013*0a6a1f1dSLionel Sambuc     }
3014*0a6a1f1dSLionel Sambuc   }
3015*0a6a1f1dSLionel Sambuc #pragma omp sections
3016*0a6a1f1dSLionel Sambuc   {
3017*0a6a1f1dSLionel Sambuc #pragma omp section
3018*0a6a1f1dSLionel Sambuc     {
3019*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a section region}}
3020*0a6a1f1dSLionel Sambuc       {
3021*0a6a1f1dSLionel Sambuc         bar();
3022*0a6a1f1dSLionel Sambuc       }
3023*0a6a1f1dSLionel Sambuc     }
3024*0a6a1f1dSLionel Sambuc   }
3025*0a6a1f1dSLionel Sambuc #pragma omp sections
3026*0a6a1f1dSLionel Sambuc   {
3027*0a6a1f1dSLionel Sambuc #pragma omp section
3028*0a6a1f1dSLionel Sambuc     {
3029*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
3030*0a6a1f1dSLionel Sambuc       bar();
3031*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}}
3032*0a6a1f1dSLionel Sambuc       bar();
3033*0a6a1f1dSLionel Sambuc #pragma omp critical
3034*0a6a1f1dSLionel Sambuc       bar();
3035*0a6a1f1dSLionel Sambuc     }
3036*0a6a1f1dSLionel Sambuc   }
3037*0a6a1f1dSLionel Sambuc #pragma omp sections
3038*0a6a1f1dSLionel Sambuc   {
3039*0a6a1f1dSLionel Sambuc #pragma omp section
3040*0a6a1f1dSLionel Sambuc     {
3041*0a6a1f1dSLionel Sambuc #pragma omp parallel
3042*0a6a1f1dSLionel Sambuc       {
3043*0a6a1f1dSLionel Sambuc #pragma omp single // OK
3044*0a6a1f1dSLionel Sambuc         {
3045*0a6a1f1dSLionel Sambuc           bar();
3046*0a6a1f1dSLionel Sambuc         }
3047*0a6a1f1dSLionel Sambuc #pragma omp for // OK
3048*0a6a1f1dSLionel Sambuc         for (int i = 0; i < 10; ++i)
3049*0a6a1f1dSLionel Sambuc           ;
3050*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
3051*0a6a1f1dSLionel Sambuc         for (int i = 0; i < 10; ++i)
3052*0a6a1f1dSLionel Sambuc           ;
3053*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
3054*0a6a1f1dSLionel Sambuc         {
3055*0a6a1f1dSLionel Sambuc           bar();
3056*0a6a1f1dSLionel Sambuc         }
3057*0a6a1f1dSLionel Sambuc       }
3058*0a6a1f1dSLionel Sambuc     }
3059*0a6a1f1dSLionel Sambuc   }
3060*0a6a1f1dSLionel Sambuc #pragma omp sections
3061*0a6a1f1dSLionel Sambuc   {
3062*0a6a1f1dSLionel Sambuc #pragma omp section
3063*0a6a1f1dSLionel Sambuc     {
3064*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3065*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3066*0a6a1f1dSLionel Sambuc         ;
3067*0a6a1f1dSLionel Sambuc     }
3068*0a6a1f1dSLionel Sambuc   }
3069*0a6a1f1dSLionel Sambuc #pragma omp sections
3070*0a6a1f1dSLionel Sambuc   {
3071*0a6a1f1dSLionel Sambuc #pragma omp section
3072*0a6a1f1dSLionel Sambuc     {
3073*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3074*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3075*0a6a1f1dSLionel Sambuc         ;
3076*0a6a1f1dSLionel Sambuc     }
3077*0a6a1f1dSLionel Sambuc   }
3078*0a6a1f1dSLionel Sambuc #pragma omp sections
3079*0a6a1f1dSLionel Sambuc   {
3080*0a6a1f1dSLionel Sambuc #pragma omp section
3081*0a6a1f1dSLionel Sambuc     {
3082*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3083*0a6a1f1dSLionel Sambuc       {
3084*0a6a1f1dSLionel Sambuc         bar();
3085*0a6a1f1dSLionel Sambuc       }
3086*0a6a1f1dSLionel Sambuc     }
3087*0a6a1f1dSLionel Sambuc   }
3088*0a6a1f1dSLionel Sambuc #pragma omp sections
3089*0a6a1f1dSLionel Sambuc   {
3090*0a6a1f1dSLionel Sambuc #pragma omp section
3091*0a6a1f1dSLionel Sambuc     {
3092*0a6a1f1dSLionel Sambuc #pragma omp task
3093*0a6a1f1dSLionel Sambuc       {
3094*0a6a1f1dSLionel Sambuc         bar();
3095*0a6a1f1dSLionel Sambuc       }
3096*0a6a1f1dSLionel Sambuc     }
3097*0a6a1f1dSLionel Sambuc   }
3098*0a6a1f1dSLionel Sambuc #pragma omp sections
3099*0a6a1f1dSLionel Sambuc   {
3100*0a6a1f1dSLionel Sambuc #pragma omp section
3101*0a6a1f1dSLionel Sambuc     {
3102*0a6a1f1dSLionel Sambuc #pragma omp taskyield
3103*0a6a1f1dSLionel Sambuc       bar();
3104*0a6a1f1dSLionel Sambuc     }
3105*0a6a1f1dSLionel Sambuc   }
3106*0a6a1f1dSLionel Sambuc #pragma omp sections
3107*0a6a1f1dSLionel Sambuc   {
3108*0a6a1f1dSLionel Sambuc #pragma omp section
3109*0a6a1f1dSLionel Sambuc     {
3110*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'section' region}}
3111*0a6a1f1dSLionel Sambuc       bar();
3112*0a6a1f1dSLionel Sambuc     }
3113*0a6a1f1dSLionel Sambuc   }
3114*0a6a1f1dSLionel Sambuc #pragma omp sections
3115*0a6a1f1dSLionel Sambuc   {
3116*0a6a1f1dSLionel Sambuc #pragma omp section
3117*0a6a1f1dSLionel Sambuc     {
3118*0a6a1f1dSLionel Sambuc #pragma omp taskwait
3119*0a6a1f1dSLionel Sambuc       bar();
3120*0a6a1f1dSLionel Sambuc     }
3121*0a6a1f1dSLionel Sambuc   }
3122*0a6a1f1dSLionel Sambuc #pragma omp sections
3123*0a6a1f1dSLionel Sambuc   {
3124*0a6a1f1dSLionel Sambuc #pragma omp section
3125*0a6a1f1dSLionel Sambuc     {
3126*0a6a1f1dSLionel Sambuc #pragma omp flush
3127*0a6a1f1dSLionel Sambuc       bar();
3128*0a6a1f1dSLionel Sambuc     }
3129*0a6a1f1dSLionel Sambuc   }
3130*0a6a1f1dSLionel Sambuc #pragma omp sections
3131*0a6a1f1dSLionel Sambuc   {
3132*0a6a1f1dSLionel Sambuc #pragma omp section
3133*0a6a1f1dSLionel Sambuc     {
3134*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
3135*0a6a1f1dSLionel Sambuc       bar();
3136*0a6a1f1dSLionel Sambuc     }
3137*0a6a1f1dSLionel Sambuc   }
3138*0a6a1f1dSLionel Sambuc #pragma omp sections
3139*0a6a1f1dSLionel Sambuc   {
3140*0a6a1f1dSLionel Sambuc #pragma omp section
3141*0a6a1f1dSLionel Sambuc     {
3142*0a6a1f1dSLionel Sambuc #pragma omp atomic
3143*0a6a1f1dSLionel Sambuc       ++a;
3144*0a6a1f1dSLionel Sambuc     }
3145*0a6a1f1dSLionel Sambuc   }
3146*0a6a1f1dSLionel Sambuc #pragma omp sections
3147*0a6a1f1dSLionel Sambuc   {
3148*0a6a1f1dSLionel Sambuc #pragma omp section
3149*0a6a1f1dSLionel Sambuc     {
3150*0a6a1f1dSLionel Sambuc #pragma omp target
3151*0a6a1f1dSLionel Sambuc       ++a;
3152*0a6a1f1dSLionel Sambuc     }
3153*0a6a1f1dSLionel Sambuc   }
3154*0a6a1f1dSLionel Sambuc #pragma omp sections
3155*0a6a1f1dSLionel Sambuc   {
3156*0a6a1f1dSLionel Sambuc #pragma omp section
3157*0a6a1f1dSLionel Sambuc     {
3158*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
3159*0a6a1f1dSLionel Sambuc       ++a;
3160*0a6a1f1dSLionel Sambuc     }
3161*0a6a1f1dSLionel Sambuc   }
3162*0a6a1f1dSLionel Sambuc 
3163*0a6a1f1dSLionel Sambuc // SINGLE DIRECTIVE
3164*0a6a1f1dSLionel Sambuc #pragma omp single
3165*0a6a1f1dSLionel Sambuc   {
3166*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
3167*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3168*0a6a1f1dSLionel Sambuc       ;
3169*0a6a1f1dSLionel Sambuc   }
3170*0a6a1f1dSLionel Sambuc #pragma omp single
3171*0a6a1f1dSLionel Sambuc   {
3172*0a6a1f1dSLionel Sambuc #pragma omp simd
3173*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3174*0a6a1f1dSLionel Sambuc       ;
3175*0a6a1f1dSLionel Sambuc   }
3176*0a6a1f1dSLionel Sambuc #pragma omp single
3177*0a6a1f1dSLionel Sambuc   {
3178*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
3179*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3180*0a6a1f1dSLionel Sambuc       ;
3181*0a6a1f1dSLionel Sambuc   }
3182*0a6a1f1dSLionel Sambuc #pragma omp single
3183*0a6a1f1dSLionel Sambuc   {
3184*0a6a1f1dSLionel Sambuc #pragma omp parallel
3185*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3186*0a6a1f1dSLionel Sambuc       ;
3187*0a6a1f1dSLionel Sambuc   }
3188*0a6a1f1dSLionel Sambuc #pragma omp single
3189*0a6a1f1dSLionel Sambuc   {
3190*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
3191*0a6a1f1dSLionel Sambuc     {
3192*0a6a1f1dSLionel Sambuc       bar();
3193*0a6a1f1dSLionel Sambuc     }
3194*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'single' region}}
3195*0a6a1f1dSLionel Sambuc     bar();
3196*0a6a1f1dSLionel Sambuc #pragma omp critical
3197*0a6a1f1dSLionel Sambuc     bar();
3198*0a6a1f1dSLionel Sambuc   }
3199*0a6a1f1dSLionel Sambuc #pragma omp single
3200*0a6a1f1dSLionel Sambuc   {
3201*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
3202*0a6a1f1dSLionel Sambuc     {
3203*0a6a1f1dSLionel Sambuc       bar();
3204*0a6a1f1dSLionel Sambuc     }
3205*0a6a1f1dSLionel Sambuc   }
3206*0a6a1f1dSLionel Sambuc #pragma omp single
3207*0a6a1f1dSLionel Sambuc   {
3208*0a6a1f1dSLionel Sambuc #pragma omp parallel
3209*0a6a1f1dSLionel Sambuc     {
3210*0a6a1f1dSLionel Sambuc #pragma omp single // OK
3211*0a6a1f1dSLionel Sambuc       {
3212*0a6a1f1dSLionel Sambuc         bar();
3213*0a6a1f1dSLionel Sambuc       }
3214*0a6a1f1dSLionel Sambuc #pragma omp for // OK
3215*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3216*0a6a1f1dSLionel Sambuc         ;
3217*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
3218*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3219*0a6a1f1dSLionel Sambuc         ;
3220*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
3221*0a6a1f1dSLionel Sambuc       {
3222*0a6a1f1dSLionel Sambuc         bar();
3223*0a6a1f1dSLionel Sambuc       }
3224*0a6a1f1dSLionel Sambuc     }
3225*0a6a1f1dSLionel Sambuc   }
3226*0a6a1f1dSLionel Sambuc #pragma omp single
3227*0a6a1f1dSLionel Sambuc   {
3228*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3229*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3230*0a6a1f1dSLionel Sambuc       ;
3231*0a6a1f1dSLionel Sambuc   }
3232*0a6a1f1dSLionel Sambuc #pragma omp single
3233*0a6a1f1dSLionel Sambuc   {
3234*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3235*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3236*0a6a1f1dSLionel Sambuc       ;
3237*0a6a1f1dSLionel Sambuc   }
3238*0a6a1f1dSLionel Sambuc #pragma omp single
3239*0a6a1f1dSLionel Sambuc   {
3240*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3241*0a6a1f1dSLionel Sambuc     {
3242*0a6a1f1dSLionel Sambuc       bar();
3243*0a6a1f1dSLionel Sambuc     }
3244*0a6a1f1dSLionel Sambuc   }
3245*0a6a1f1dSLionel Sambuc #pragma omp single
3246*0a6a1f1dSLionel Sambuc   {
3247*0a6a1f1dSLionel Sambuc #pragma omp task
3248*0a6a1f1dSLionel Sambuc     {
3249*0a6a1f1dSLionel Sambuc       bar();
3250*0a6a1f1dSLionel Sambuc     }
3251*0a6a1f1dSLionel Sambuc   }
3252*0a6a1f1dSLionel Sambuc #pragma omp single
3253*0a6a1f1dSLionel Sambuc   {
3254*0a6a1f1dSLionel Sambuc #pragma omp taskyield
3255*0a6a1f1dSLionel Sambuc     bar();
3256*0a6a1f1dSLionel Sambuc   }
3257*0a6a1f1dSLionel Sambuc #pragma omp single
3258*0a6a1f1dSLionel Sambuc   {
3259*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'single' region}}
3260*0a6a1f1dSLionel Sambuc     bar();
3261*0a6a1f1dSLionel Sambuc   }
3262*0a6a1f1dSLionel Sambuc #pragma omp single
3263*0a6a1f1dSLionel Sambuc   {
3264*0a6a1f1dSLionel Sambuc #pragma omp taskwait
3265*0a6a1f1dSLionel Sambuc     bar();
3266*0a6a1f1dSLionel Sambuc   }
3267*0a6a1f1dSLionel Sambuc #pragma omp single
3268*0a6a1f1dSLionel Sambuc   {
3269*0a6a1f1dSLionel Sambuc #pragma omp flush
3270*0a6a1f1dSLionel Sambuc     bar();
3271*0a6a1f1dSLionel Sambuc   }
3272*0a6a1f1dSLionel Sambuc #pragma omp single
3273*0a6a1f1dSLionel Sambuc   {
3274*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
3275*0a6a1f1dSLionel Sambuc     bar();
3276*0a6a1f1dSLionel Sambuc   }
3277*0a6a1f1dSLionel Sambuc #pragma omp single
3278*0a6a1f1dSLionel Sambuc   {
3279*0a6a1f1dSLionel Sambuc #pragma omp atomic
3280*0a6a1f1dSLionel Sambuc     ++a;
3281*0a6a1f1dSLionel Sambuc   }
3282*0a6a1f1dSLionel Sambuc #pragma omp single
3283*0a6a1f1dSLionel Sambuc   {
3284*0a6a1f1dSLionel Sambuc #pragma omp target
3285*0a6a1f1dSLionel Sambuc     ++a;
3286*0a6a1f1dSLionel Sambuc   }
3287*0a6a1f1dSLionel Sambuc #pragma omp single
3288*0a6a1f1dSLionel Sambuc   {
3289*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
3290*0a6a1f1dSLionel Sambuc     ++a;
3291*0a6a1f1dSLionel Sambuc   }
3292*0a6a1f1dSLionel Sambuc 
3293*0a6a1f1dSLionel Sambuc // MASTER DIRECTIVE
3294*0a6a1f1dSLionel Sambuc #pragma omp master
3295*0a6a1f1dSLionel Sambuc   {
3296*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
3297*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3298*0a6a1f1dSLionel Sambuc       ;
3299*0a6a1f1dSLionel Sambuc   }
3300*0a6a1f1dSLionel Sambuc #pragma omp master
3301*0a6a1f1dSLionel Sambuc   {
3302*0a6a1f1dSLionel Sambuc #pragma omp simd
3303*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3304*0a6a1f1dSLionel Sambuc       ;
3305*0a6a1f1dSLionel Sambuc   }
3306*0a6a1f1dSLionel Sambuc #pragma omp master
3307*0a6a1f1dSLionel Sambuc   {
3308*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
3309*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3310*0a6a1f1dSLionel Sambuc       ;
3311*0a6a1f1dSLionel Sambuc   }
3312*0a6a1f1dSLionel Sambuc #pragma omp master
3313*0a6a1f1dSLionel Sambuc   {
3314*0a6a1f1dSLionel Sambuc #pragma omp parallel
3315*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3316*0a6a1f1dSLionel Sambuc       ;
3317*0a6a1f1dSLionel Sambuc   }
3318*0a6a1f1dSLionel Sambuc #pragma omp master
3319*0a6a1f1dSLionel Sambuc   {
3320*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
3321*0a6a1f1dSLionel Sambuc     {
3322*0a6a1f1dSLionel Sambuc       bar();
3323*0a6a1f1dSLionel Sambuc     }
3324*0a6a1f1dSLionel Sambuc   }
3325*0a6a1f1dSLionel Sambuc #pragma omp master
3326*0a6a1f1dSLionel Sambuc   {
3327*0a6a1f1dSLionel Sambuc #pragma omp master // OK, though second 'master' is redundant
3328*0a6a1f1dSLionel Sambuc     {
3329*0a6a1f1dSLionel Sambuc       bar();
3330*0a6a1f1dSLionel Sambuc     }
3331*0a6a1f1dSLionel Sambuc   }
3332*0a6a1f1dSLionel Sambuc #pragma omp master
3333*0a6a1f1dSLionel Sambuc   {
3334*0a6a1f1dSLionel Sambuc #pragma omp critical
3335*0a6a1f1dSLionel Sambuc     {
3336*0a6a1f1dSLionel Sambuc       bar();
3337*0a6a1f1dSLionel Sambuc     }
3338*0a6a1f1dSLionel Sambuc   }
3339*0a6a1f1dSLionel Sambuc #pragma omp master
3340*0a6a1f1dSLionel Sambuc   {
3341*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
3342*0a6a1f1dSLionel Sambuc     {
3343*0a6a1f1dSLionel Sambuc       bar();
3344*0a6a1f1dSLionel Sambuc     }
3345*0a6a1f1dSLionel Sambuc   }
3346*0a6a1f1dSLionel Sambuc #pragma omp master
3347*0a6a1f1dSLionel Sambuc   {
3348*0a6a1f1dSLionel Sambuc #pragma omp parallel
3349*0a6a1f1dSLionel Sambuc     {
3350*0a6a1f1dSLionel Sambuc #pragma omp master // OK
3351*0a6a1f1dSLionel Sambuc       {
3352*0a6a1f1dSLionel Sambuc         bar();
3353*0a6a1f1dSLionel Sambuc       }
3354*0a6a1f1dSLionel Sambuc #pragma omp for // OK
3355*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3356*0a6a1f1dSLionel Sambuc         ;
3357*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
3358*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3359*0a6a1f1dSLionel Sambuc         ;
3360*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
3361*0a6a1f1dSLionel Sambuc       {
3362*0a6a1f1dSLionel Sambuc         bar();
3363*0a6a1f1dSLionel Sambuc       }
3364*0a6a1f1dSLionel Sambuc     }
3365*0a6a1f1dSLionel Sambuc   }
3366*0a6a1f1dSLionel Sambuc #pragma omp master
3367*0a6a1f1dSLionel Sambuc   {
3368*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3369*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3370*0a6a1f1dSLionel Sambuc       ;
3371*0a6a1f1dSLionel Sambuc   }
3372*0a6a1f1dSLionel Sambuc #pragma omp master
3373*0a6a1f1dSLionel Sambuc   {
3374*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3375*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3376*0a6a1f1dSLionel Sambuc       ;
3377*0a6a1f1dSLionel Sambuc   }
3378*0a6a1f1dSLionel Sambuc #pragma omp master
3379*0a6a1f1dSLionel Sambuc   {
3380*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3381*0a6a1f1dSLionel Sambuc     {
3382*0a6a1f1dSLionel Sambuc       bar();
3383*0a6a1f1dSLionel Sambuc     }
3384*0a6a1f1dSLionel Sambuc   }
3385*0a6a1f1dSLionel Sambuc #pragma omp master
3386*0a6a1f1dSLionel Sambuc   {
3387*0a6a1f1dSLionel Sambuc #pragma omp task
3388*0a6a1f1dSLionel Sambuc     {
3389*0a6a1f1dSLionel Sambuc       bar();
3390*0a6a1f1dSLionel Sambuc     }
3391*0a6a1f1dSLionel Sambuc   }
3392*0a6a1f1dSLionel Sambuc #pragma omp master
3393*0a6a1f1dSLionel Sambuc   {
3394*0a6a1f1dSLionel Sambuc #pragma omp taskyield
3395*0a6a1f1dSLionel Sambuc     bar();
3396*0a6a1f1dSLionel Sambuc   }
3397*0a6a1f1dSLionel Sambuc #pragma omp master
3398*0a6a1f1dSLionel Sambuc   {
3399*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'master' region}}
3400*0a6a1f1dSLionel Sambuc     bar();
3401*0a6a1f1dSLionel Sambuc   }
3402*0a6a1f1dSLionel Sambuc #pragma omp master
3403*0a6a1f1dSLionel Sambuc   {
3404*0a6a1f1dSLionel Sambuc #pragma omp taskwait
3405*0a6a1f1dSLionel Sambuc     bar();
3406*0a6a1f1dSLionel Sambuc   }
3407*0a6a1f1dSLionel Sambuc #pragma omp master
3408*0a6a1f1dSLionel Sambuc   {
3409*0a6a1f1dSLionel Sambuc #pragma omp flush
3410*0a6a1f1dSLionel Sambuc     bar();
3411*0a6a1f1dSLionel Sambuc   }
3412*0a6a1f1dSLionel Sambuc #pragma omp master
3413*0a6a1f1dSLionel Sambuc   {
3414*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
3415*0a6a1f1dSLionel Sambuc     bar();
3416*0a6a1f1dSLionel Sambuc   }
3417*0a6a1f1dSLionel Sambuc #pragma omp master
3418*0a6a1f1dSLionel Sambuc   {
3419*0a6a1f1dSLionel Sambuc #pragma omp atomic
3420*0a6a1f1dSLionel Sambuc     ++a;
3421*0a6a1f1dSLionel Sambuc   }
3422*0a6a1f1dSLionel Sambuc #pragma omp master
3423*0a6a1f1dSLionel Sambuc   {
3424*0a6a1f1dSLionel Sambuc #pragma omp target
3425*0a6a1f1dSLionel Sambuc     ++a;
3426*0a6a1f1dSLionel Sambuc   }
3427*0a6a1f1dSLionel Sambuc #pragma omp master
3428*0a6a1f1dSLionel Sambuc   {
3429*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
3430*0a6a1f1dSLionel Sambuc     ++a;
3431*0a6a1f1dSLionel Sambuc   }
3432*0a6a1f1dSLionel Sambuc 
3433*0a6a1f1dSLionel Sambuc // CRITICAL DIRECTIVE
3434*0a6a1f1dSLionel Sambuc #pragma omp critical
3435*0a6a1f1dSLionel Sambuc   {
3436*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
3437*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3438*0a6a1f1dSLionel Sambuc       ;
3439*0a6a1f1dSLionel Sambuc   }
3440*0a6a1f1dSLionel Sambuc #pragma omp critical
3441*0a6a1f1dSLionel Sambuc   {
3442*0a6a1f1dSLionel Sambuc #pragma omp simd
3443*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3444*0a6a1f1dSLionel Sambuc       ;
3445*0a6a1f1dSLionel Sambuc   }
3446*0a6a1f1dSLionel Sambuc #pragma omp critical
3447*0a6a1f1dSLionel Sambuc   {
3448*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
3449*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3450*0a6a1f1dSLionel Sambuc       ;
3451*0a6a1f1dSLionel Sambuc   }
3452*0a6a1f1dSLionel Sambuc #pragma omp critical
3453*0a6a1f1dSLionel Sambuc   {
3454*0a6a1f1dSLionel Sambuc #pragma omp parallel
3455*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3456*0a6a1f1dSLionel Sambuc       ;
3457*0a6a1f1dSLionel Sambuc   }
3458*0a6a1f1dSLionel Sambuc #pragma omp critical
3459*0a6a1f1dSLionel Sambuc   {
3460*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
3461*0a6a1f1dSLionel Sambuc     {
3462*0a6a1f1dSLionel Sambuc       bar();
3463*0a6a1f1dSLionel Sambuc     }
3464*0a6a1f1dSLionel Sambuc   }
3465*0a6a1f1dSLionel Sambuc #pragma omp critical
3466*0a6a1f1dSLionel Sambuc   {
3467*0a6a1f1dSLionel Sambuc #pragma omp master // OK, though second 'master' is redundant
3468*0a6a1f1dSLionel Sambuc     {
3469*0a6a1f1dSLionel Sambuc       bar();
3470*0a6a1f1dSLionel Sambuc     }
3471*0a6a1f1dSLionel Sambuc   }
3472*0a6a1f1dSLionel Sambuc #pragma omp critical
3473*0a6a1f1dSLionel Sambuc   {
3474*0a6a1f1dSLionel Sambuc #pragma omp critical
3475*0a6a1f1dSLionel Sambuc     {
3476*0a6a1f1dSLionel Sambuc       bar();
3477*0a6a1f1dSLionel Sambuc     }
3478*0a6a1f1dSLionel Sambuc   }
3479*0a6a1f1dSLionel Sambuc #pragma omp critical
3480*0a6a1f1dSLionel Sambuc   {
3481*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
3482*0a6a1f1dSLionel Sambuc     {
3483*0a6a1f1dSLionel Sambuc       bar();
3484*0a6a1f1dSLionel Sambuc     }
3485*0a6a1f1dSLionel Sambuc   }
3486*0a6a1f1dSLionel Sambuc #pragma omp critical
3487*0a6a1f1dSLionel Sambuc   {
3488*0a6a1f1dSLionel Sambuc #pragma omp parallel
3489*0a6a1f1dSLionel Sambuc     {
3490*0a6a1f1dSLionel Sambuc #pragma omp master // OK
3491*0a6a1f1dSLionel Sambuc       {
3492*0a6a1f1dSLionel Sambuc         bar();
3493*0a6a1f1dSLionel Sambuc       }
3494*0a6a1f1dSLionel Sambuc #pragma omp for // OK
3495*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3496*0a6a1f1dSLionel Sambuc         ;
3497*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
3498*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3499*0a6a1f1dSLionel Sambuc         ;
3500*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
3501*0a6a1f1dSLionel Sambuc       {
3502*0a6a1f1dSLionel Sambuc         bar();
3503*0a6a1f1dSLionel Sambuc       }
3504*0a6a1f1dSLionel Sambuc     }
3505*0a6a1f1dSLionel Sambuc   }
3506*0a6a1f1dSLionel Sambuc #pragma omp critical
3507*0a6a1f1dSLionel Sambuc   {
3508*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3509*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3510*0a6a1f1dSLionel Sambuc       ;
3511*0a6a1f1dSLionel Sambuc   }
3512*0a6a1f1dSLionel Sambuc #pragma omp critical
3513*0a6a1f1dSLionel Sambuc   {
3514*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3515*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3516*0a6a1f1dSLionel Sambuc       ;
3517*0a6a1f1dSLionel Sambuc   }
3518*0a6a1f1dSLionel Sambuc #pragma omp critical
3519*0a6a1f1dSLionel Sambuc   {
3520*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3521*0a6a1f1dSLionel Sambuc     {
3522*0a6a1f1dSLionel Sambuc       bar();
3523*0a6a1f1dSLionel Sambuc     }
3524*0a6a1f1dSLionel Sambuc   }
3525*0a6a1f1dSLionel Sambuc #pragma omp critical
3526*0a6a1f1dSLionel Sambuc   {
3527*0a6a1f1dSLionel Sambuc #pragma omp task
3528*0a6a1f1dSLionel Sambuc     {
3529*0a6a1f1dSLionel Sambuc       bar();
3530*0a6a1f1dSLionel Sambuc     }
3531*0a6a1f1dSLionel Sambuc   }
3532*0a6a1f1dSLionel Sambuc #pragma omp critical
3533*0a6a1f1dSLionel Sambuc   {
3534*0a6a1f1dSLionel Sambuc #pragma omp taskyield
3535*0a6a1f1dSLionel Sambuc     bar();
3536*0a6a1f1dSLionel Sambuc   }
3537*0a6a1f1dSLionel Sambuc #pragma omp critical
3538*0a6a1f1dSLionel Sambuc   {
3539*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'critical' region}}
3540*0a6a1f1dSLionel Sambuc     bar();
3541*0a6a1f1dSLionel Sambuc   }
3542*0a6a1f1dSLionel Sambuc #pragma omp critical
3543*0a6a1f1dSLionel Sambuc   {
3544*0a6a1f1dSLionel Sambuc #pragma omp taskwait
3545*0a6a1f1dSLionel Sambuc     bar();
3546*0a6a1f1dSLionel Sambuc   }
3547*0a6a1f1dSLionel Sambuc #pragma omp critical(Belka)
3548*0a6a1f1dSLionel Sambuc   {
3549*0a6a1f1dSLionel Sambuc #pragma omp critical(Strelka)
3550*0a6a1f1dSLionel Sambuc     bar();
3551*0a6a1f1dSLionel Sambuc   }
3552*0a6a1f1dSLionel Sambuc #pragma omp critical(Tuzik) // expected-note {{previous 'critical' region starts here}}
3553*0a6a1f1dSLionel Sambuc   {
3554*0a6a1f1dSLionel Sambuc #pragma omp critical(grelka) // expected-note {{previous 'critical' region starts here}}
3555*0a6a1f1dSLionel Sambuc     {
3556*0a6a1f1dSLionel Sambuc #pragma omp critical(Tuzik) // expected-error {{cannot nest 'critical' regions having the same name 'Tuzik'}}
3557*0a6a1f1dSLionel Sambuc       {
3558*0a6a1f1dSLionel Sambuc #pragma omp parallel
3559*0a6a1f1dSLionel Sambuc #pragma omp critical(grelka) // expected-error {{cannot nest 'critical' regions having the same name 'grelka'}}
3560*0a6a1f1dSLionel Sambuc         {
3561*0a6a1f1dSLionel Sambuc           bar();
3562*0a6a1f1dSLionel Sambuc         }
3563*0a6a1f1dSLionel Sambuc       }
3564*0a6a1f1dSLionel Sambuc     }
3565*0a6a1f1dSLionel Sambuc   }
3566*0a6a1f1dSLionel Sambuc #pragma omp critical
3567*0a6a1f1dSLionel Sambuc   {
3568*0a6a1f1dSLionel Sambuc #pragma omp flush
3569*0a6a1f1dSLionel Sambuc     bar();
3570*0a6a1f1dSLionel Sambuc   }
3571*0a6a1f1dSLionel Sambuc #pragma omp critical
3572*0a6a1f1dSLionel Sambuc   {
3573*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
3574*0a6a1f1dSLionel Sambuc     bar();
3575*0a6a1f1dSLionel Sambuc   }
3576*0a6a1f1dSLionel Sambuc #pragma omp critical
3577*0a6a1f1dSLionel Sambuc   {
3578*0a6a1f1dSLionel Sambuc #pragma omp atomic
3579*0a6a1f1dSLionel Sambuc     ++a;
3580*0a6a1f1dSLionel Sambuc   }
3581*0a6a1f1dSLionel Sambuc #pragma omp critical
3582*0a6a1f1dSLionel Sambuc   {
3583*0a6a1f1dSLionel Sambuc #pragma omp target
3584*0a6a1f1dSLionel Sambuc     ++a;
3585*0a6a1f1dSLionel Sambuc   }
3586*0a6a1f1dSLionel Sambuc #pragma omp critical
3587*0a6a1f1dSLionel Sambuc   {
3588*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
3589*0a6a1f1dSLionel Sambuc     ++a;
3590*0a6a1f1dSLionel Sambuc   }
3591*0a6a1f1dSLionel Sambuc 
3592*0a6a1f1dSLionel Sambuc // PARALLEL FOR DIRECTIVE
3593*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3594*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3595*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
3596*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3597*0a6a1f1dSLionel Sambuc       ;
3598*0a6a1f1dSLionel Sambuc   }
3599*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3600*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3601*0a6a1f1dSLionel Sambuc #pragma omp simd
3602*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3603*0a6a1f1dSLionel Sambuc       ;
3604*0a6a1f1dSLionel Sambuc   }
3605*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3606*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3607*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
3608*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3609*0a6a1f1dSLionel Sambuc       ;
3610*0a6a1f1dSLionel Sambuc   }
3611*0a6a1f1dSLionel Sambuc 
3612*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3613*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3614*0a6a1f1dSLionel Sambuc #pragma omp parallel
3615*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3616*0a6a1f1dSLionel Sambuc       ;
3617*0a6a1f1dSLionel Sambuc   }
3618*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3619*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3620*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
3621*0a6a1f1dSLionel Sambuc     {
3622*0a6a1f1dSLionel Sambuc       bar();
3623*0a6a1f1dSLionel Sambuc     }
3624*0a6a1f1dSLionel Sambuc   }
3625*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3626*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3627*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel for region}}
3628*0a6a1f1dSLionel Sambuc     {
3629*0a6a1f1dSLionel Sambuc       bar();
3630*0a6a1f1dSLionel Sambuc     }
3631*0a6a1f1dSLionel Sambuc   }
3632*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3633*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3634*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
3635*0a6a1f1dSLionel Sambuc     {
3636*0a6a1f1dSLionel Sambuc       bar();
3637*0a6a1f1dSLionel Sambuc     }
3638*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'parallel for' region}}
3639*0a6a1f1dSLionel Sambuc     {
3640*0a6a1f1dSLionel Sambuc       bar();
3641*0a6a1f1dSLionel Sambuc     }
3642*0a6a1f1dSLionel Sambuc #pragma omp critical
3643*0a6a1f1dSLionel Sambuc     {
3644*0a6a1f1dSLionel Sambuc       bar();
3645*0a6a1f1dSLionel Sambuc     }
3646*0a6a1f1dSLionel Sambuc   }
3647*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3648*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3649*0a6a1f1dSLionel Sambuc #pragma omp parallel
3650*0a6a1f1dSLionel Sambuc     {
3651*0a6a1f1dSLionel Sambuc #pragma omp single // OK
3652*0a6a1f1dSLionel Sambuc       {
3653*0a6a1f1dSLionel Sambuc         bar();
3654*0a6a1f1dSLionel Sambuc       }
3655*0a6a1f1dSLionel Sambuc #pragma omp master // OK
3656*0a6a1f1dSLionel Sambuc       {
3657*0a6a1f1dSLionel Sambuc         bar();
3658*0a6a1f1dSLionel Sambuc       }
3659*0a6a1f1dSLionel Sambuc #pragma omp critical // OK
3660*0a6a1f1dSLionel Sambuc       {
3661*0a6a1f1dSLionel Sambuc         bar();
3662*0a6a1f1dSLionel Sambuc       }
3663*0a6a1f1dSLionel Sambuc #pragma omp for // OK
3664*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3665*0a6a1f1dSLionel Sambuc         ;
3666*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
3667*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3668*0a6a1f1dSLionel Sambuc         ;
3669*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
3670*0a6a1f1dSLionel Sambuc       {
3671*0a6a1f1dSLionel Sambuc         bar();
3672*0a6a1f1dSLionel Sambuc       }
3673*0a6a1f1dSLionel Sambuc     }
3674*0a6a1f1dSLionel Sambuc   }
3675*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3676*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3677*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3678*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3679*0a6a1f1dSLionel Sambuc       ;
3680*0a6a1f1dSLionel Sambuc   }
3681*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3682*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3683*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3684*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3685*0a6a1f1dSLionel Sambuc       ;
3686*0a6a1f1dSLionel Sambuc   }
3687*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3688*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3689*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3690*0a6a1f1dSLionel Sambuc     {
3691*0a6a1f1dSLionel Sambuc       bar();
3692*0a6a1f1dSLionel Sambuc     }
3693*0a6a1f1dSLionel Sambuc   }
3694*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3695*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3696*0a6a1f1dSLionel Sambuc #pragma omp task
3697*0a6a1f1dSLionel Sambuc     {
3698*0a6a1f1dSLionel Sambuc       bar();
3699*0a6a1f1dSLionel Sambuc     }
3700*0a6a1f1dSLionel Sambuc   }
3701*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3702*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3703*0a6a1f1dSLionel Sambuc #pragma omp taskyield
3704*0a6a1f1dSLionel Sambuc     bar();
3705*0a6a1f1dSLionel Sambuc   }
3706*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3707*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3708*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel for' region}}
3709*0a6a1f1dSLionel Sambuc     bar();
3710*0a6a1f1dSLionel Sambuc   }
3711*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3712*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3713*0a6a1f1dSLionel Sambuc #pragma omp taskwait
3714*0a6a1f1dSLionel Sambuc     bar();
3715*0a6a1f1dSLionel Sambuc   }
3716*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3717*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3718*0a6a1f1dSLionel Sambuc #pragma omp flush
3719*0a6a1f1dSLionel Sambuc     bar();
3720*0a6a1f1dSLionel Sambuc   }
3721*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3722*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3723*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
3724*0a6a1f1dSLionel Sambuc     bar();
3725*0a6a1f1dSLionel Sambuc   }
3726*0a6a1f1dSLionel Sambuc #pragma omp parallel for ordered
3727*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3728*0a6a1f1dSLionel Sambuc #pragma omp ordered // OK
3729*0a6a1f1dSLionel Sambuc     bar();
3730*0a6a1f1dSLionel Sambuc   }
3731*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3732*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3733*0a6a1f1dSLionel Sambuc #pragma omp atomic
3734*0a6a1f1dSLionel Sambuc     ++a;
3735*0a6a1f1dSLionel Sambuc   }
3736*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3737*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3738*0a6a1f1dSLionel Sambuc #pragma omp target
3739*0a6a1f1dSLionel Sambuc     ++a;
3740*0a6a1f1dSLionel Sambuc   }
3741*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3742*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3743*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
3744*0a6a1f1dSLionel Sambuc     ++a;
3745*0a6a1f1dSLionel Sambuc   }
3746*0a6a1f1dSLionel Sambuc 
3747*0a6a1f1dSLionel Sambuc // PARALLEL FOR SIMD DIRECTIVE
3748*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3749*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3750*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3751*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3752*0a6a1f1dSLionel Sambuc       ;
3753*0a6a1f1dSLionel Sambuc   }
3754*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3755*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3756*0a6a1f1dSLionel Sambuc #pragma omp simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
3757*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3758*0a6a1f1dSLionel Sambuc       ;
3759*0a6a1f1dSLionel Sambuc   }
3760*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3761*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3762*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3763*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3764*0a6a1f1dSLionel Sambuc       ;
3765*0a6a1f1dSLionel Sambuc   }
3766*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3767*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3768*0a6a1f1dSLionel Sambuc #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3769*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3770*0a6a1f1dSLionel Sambuc       ;
3771*0a6a1f1dSLionel Sambuc   }
3772*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3773*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3774*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3775*0a6a1f1dSLionel Sambuc     {
3776*0a6a1f1dSLionel Sambuc       bar();
3777*0a6a1f1dSLionel Sambuc     }
3778*0a6a1f1dSLionel Sambuc   }
3779*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3780*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3781*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3782*0a6a1f1dSLionel Sambuc     {
3783*0a6a1f1dSLionel Sambuc       bar();
3784*0a6a1f1dSLionel Sambuc     }
3785*0a6a1f1dSLionel Sambuc   }
3786*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3787*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3788*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3789*0a6a1f1dSLionel Sambuc     {
3790*0a6a1f1dSLionel Sambuc       bar();
3791*0a6a1f1dSLionel Sambuc     }
3792*0a6a1f1dSLionel Sambuc   }
3793*0a6a1f1dSLionel Sambuc 
3794*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3795*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3796*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3797*0a6a1f1dSLionel Sambuc     {
3798*0a6a1f1dSLionel Sambuc       bar();
3799*0a6a1f1dSLionel Sambuc     }
3800*0a6a1f1dSLionel Sambuc   }
3801*0a6a1f1dSLionel Sambuc 
3802*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3803*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3804*0a6a1f1dSLionel Sambuc #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3805*0a6a1f1dSLionel Sambuc     {
3806*0a6a1f1dSLionel Sambuc       bar();
3807*0a6a1f1dSLionel Sambuc     }
3808*0a6a1f1dSLionel Sambuc   }
3809*0a6a1f1dSLionel Sambuc 
3810*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3811*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3812*0a6a1f1dSLionel Sambuc #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3813*0a6a1f1dSLionel Sambuc     {
3814*0a6a1f1dSLionel Sambuc #pragma omp single
3815*0a6a1f1dSLionel Sambuc       {
3816*0a6a1f1dSLionel Sambuc         bar();
3817*0a6a1f1dSLionel Sambuc       }
3818*0a6a1f1dSLionel Sambuc #pragma omp for
3819*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3820*0a6a1f1dSLionel Sambuc         ;
3821*0a6a1f1dSLionel Sambuc #pragma omp for simd
3822*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3823*0a6a1f1dSLionel Sambuc         ;
3824*0a6a1f1dSLionel Sambuc #pragma omp sections
3825*0a6a1f1dSLionel Sambuc       {
3826*0a6a1f1dSLionel Sambuc         bar();
3827*0a6a1f1dSLionel Sambuc       }
3828*0a6a1f1dSLionel Sambuc     }
3829*0a6a1f1dSLionel Sambuc   }
3830*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3831*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3832*0a6a1f1dSLionel Sambuc #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3833*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3834*0a6a1f1dSLionel Sambuc       ;
3835*0a6a1f1dSLionel Sambuc   }
3836*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3837*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3838*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
3839*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3840*0a6a1f1dSLionel Sambuc       ;
3841*0a6a1f1dSLionel Sambuc   }
3842*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3843*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3844*0a6a1f1dSLionel Sambuc #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3845*0a6a1f1dSLionel Sambuc     {
3846*0a6a1f1dSLionel Sambuc       bar();
3847*0a6a1f1dSLionel Sambuc     }
3848*0a6a1f1dSLionel Sambuc   }
3849*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3850*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3851*0a6a1f1dSLionel Sambuc #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3852*0a6a1f1dSLionel Sambuc     {
3853*0a6a1f1dSLionel Sambuc       bar();
3854*0a6a1f1dSLionel Sambuc     }
3855*0a6a1f1dSLionel Sambuc   }
3856*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3857*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3858*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3859*0a6a1f1dSLionel Sambuc     bar();
3860*0a6a1f1dSLionel Sambuc   }
3861*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3862*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3863*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3864*0a6a1f1dSLionel Sambuc     bar();
3865*0a6a1f1dSLionel Sambuc   }
3866*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3867*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3868*0a6a1f1dSLionel Sambuc #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3869*0a6a1f1dSLionel Sambuc     bar();
3870*0a6a1f1dSLionel Sambuc   }
3871*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3872*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3873*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3874*0a6a1f1dSLionel Sambuc     bar();
3875*0a6a1f1dSLionel Sambuc   }
3876*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3877*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3878*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3879*0a6a1f1dSLionel Sambuc     bar();
3880*0a6a1f1dSLionel Sambuc   }
3881*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3882*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3883*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3884*0a6a1f1dSLionel Sambuc     bar();
3885*0a6a1f1dSLionel Sambuc   }
3886*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3887*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3888*0a6a1f1dSLionel Sambuc #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3889*0a6a1f1dSLionel Sambuc     ++a;
3890*0a6a1f1dSLionel Sambuc   }
3891*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3892*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3893*0a6a1f1dSLionel Sambuc #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3894*0a6a1f1dSLionel Sambuc     ++a;
3895*0a6a1f1dSLionel Sambuc   }
3896*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3897*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
3898*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3899*0a6a1f1dSLionel Sambuc     ++a;
3900*0a6a1f1dSLionel Sambuc   }
3901*0a6a1f1dSLionel Sambuc 
3902*0a6a1f1dSLionel Sambuc // PARALLEL SECTIONS DIRECTIVE
3903*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3904*0a6a1f1dSLionel Sambuc   {
3905*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
3906*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3907*0a6a1f1dSLionel Sambuc       ;
3908*0a6a1f1dSLionel Sambuc   }
3909*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3910*0a6a1f1dSLionel Sambuc   {
3911*0a6a1f1dSLionel Sambuc #pragma omp simd
3912*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3913*0a6a1f1dSLionel Sambuc       ;
3914*0a6a1f1dSLionel Sambuc   }
3915*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3916*0a6a1f1dSLionel Sambuc   {
3917*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
3918*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3919*0a6a1f1dSLionel Sambuc       ;
3920*0a6a1f1dSLionel Sambuc   }
3921*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3922*0a6a1f1dSLionel Sambuc   {
3923*0a6a1f1dSLionel Sambuc #pragma omp parallel
3924*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3925*0a6a1f1dSLionel Sambuc       ;
3926*0a6a1f1dSLionel Sambuc   }
3927*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3928*0a6a1f1dSLionel Sambuc   {
3929*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
3930*0a6a1f1dSLionel Sambuc     {
3931*0a6a1f1dSLionel Sambuc       bar();
3932*0a6a1f1dSLionel Sambuc     }
3933*0a6a1f1dSLionel Sambuc   }
3934*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3935*0a6a1f1dSLionel Sambuc   {
3936*0a6a1f1dSLionel Sambuc #pragma omp section
3937*0a6a1f1dSLionel Sambuc     {
3938*0a6a1f1dSLionel Sambuc       bar();
3939*0a6a1f1dSLionel Sambuc     }
3940*0a6a1f1dSLionel Sambuc   }
3941*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3942*0a6a1f1dSLionel Sambuc   {
3943*0a6a1f1dSLionel Sambuc #pragma omp section
3944*0a6a1f1dSLionel Sambuc     {
3945*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
3946*0a6a1f1dSLionel Sambuc       bar();
3947*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}}
3948*0a6a1f1dSLionel Sambuc       bar();
3949*0a6a1f1dSLionel Sambuc #pragma omp critical
3950*0a6a1f1dSLionel Sambuc       bar();
3951*0a6a1f1dSLionel Sambuc     }
3952*0a6a1f1dSLionel Sambuc   }
3953*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3954*0a6a1f1dSLionel Sambuc   {
3955*0a6a1f1dSLionel Sambuc #pragma omp parallel
3956*0a6a1f1dSLionel Sambuc     {
3957*0a6a1f1dSLionel Sambuc #pragma omp single // OK
3958*0a6a1f1dSLionel Sambuc       {
3959*0a6a1f1dSLionel Sambuc         bar();
3960*0a6a1f1dSLionel Sambuc       }
3961*0a6a1f1dSLionel Sambuc #pragma omp master // OK
3962*0a6a1f1dSLionel Sambuc       {
3963*0a6a1f1dSLionel Sambuc         bar();
3964*0a6a1f1dSLionel Sambuc       }
3965*0a6a1f1dSLionel Sambuc #pragma omp critical // OK
3966*0a6a1f1dSLionel Sambuc       {
3967*0a6a1f1dSLionel Sambuc         bar();
3968*0a6a1f1dSLionel Sambuc       }
3969*0a6a1f1dSLionel Sambuc #pragma omp for // OK
3970*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3971*0a6a1f1dSLionel Sambuc         ;
3972*0a6a1f1dSLionel Sambuc #pragma omp for simd // OK
3973*0a6a1f1dSLionel Sambuc       for (int i = 0; i < 10; ++i)
3974*0a6a1f1dSLionel Sambuc         ;
3975*0a6a1f1dSLionel Sambuc #pragma omp sections // OK
3976*0a6a1f1dSLionel Sambuc       {
3977*0a6a1f1dSLionel Sambuc         bar();
3978*0a6a1f1dSLionel Sambuc       }
3979*0a6a1f1dSLionel Sambuc     }
3980*0a6a1f1dSLionel Sambuc   }
3981*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3982*0a6a1f1dSLionel Sambuc   {
3983*0a6a1f1dSLionel Sambuc #pragma omp parallel for
3984*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3985*0a6a1f1dSLionel Sambuc       ;
3986*0a6a1f1dSLionel Sambuc   }
3987*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3988*0a6a1f1dSLionel Sambuc   {
3989*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
3990*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
3991*0a6a1f1dSLionel Sambuc       ;
3992*0a6a1f1dSLionel Sambuc   }
3993*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3994*0a6a1f1dSLionel Sambuc   {
3995*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
3996*0a6a1f1dSLionel Sambuc     {
3997*0a6a1f1dSLionel Sambuc       bar();
3998*0a6a1f1dSLionel Sambuc     }
3999*0a6a1f1dSLionel Sambuc   }
4000*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
4001*0a6a1f1dSLionel Sambuc   {
4002*0a6a1f1dSLionel Sambuc #pragma omp task
4003*0a6a1f1dSLionel Sambuc     {
4004*0a6a1f1dSLionel Sambuc       bar();
4005*0a6a1f1dSLionel Sambuc     }
4006*0a6a1f1dSLionel Sambuc   }
4007*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
4008*0a6a1f1dSLionel Sambuc   {
4009*0a6a1f1dSLionel Sambuc #pragma omp taskyield
4010*0a6a1f1dSLionel Sambuc   }
4011*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
4012*0a6a1f1dSLionel Sambuc   {
4013*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel sections' region}}
4014*0a6a1f1dSLionel Sambuc   }
4015*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
4016*0a6a1f1dSLionel Sambuc   {
4017*0a6a1f1dSLionel Sambuc #pragma omp taskwait
4018*0a6a1f1dSLionel Sambuc   }
4019*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
4020*0a6a1f1dSLionel Sambuc   {
4021*0a6a1f1dSLionel Sambuc #pragma omp flush
4022*0a6a1f1dSLionel Sambuc   }
4023*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
4024*0a6a1f1dSLionel Sambuc   {
4025*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
4026*0a6a1f1dSLionel Sambuc     bar();
4027*0a6a1f1dSLionel Sambuc   }
4028*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
4029*0a6a1f1dSLionel Sambuc   {
4030*0a6a1f1dSLionel Sambuc #pragma omp atomic
4031*0a6a1f1dSLionel Sambuc     ++a;
4032*0a6a1f1dSLionel Sambuc   }
4033*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
4034*0a6a1f1dSLionel Sambuc   {
4035*0a6a1f1dSLionel Sambuc #pragma omp target
4036*0a6a1f1dSLionel Sambuc     ++a;
4037*0a6a1f1dSLionel Sambuc   }
4038*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
4039*0a6a1f1dSLionel Sambuc   {
4040*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
4041*0a6a1f1dSLionel Sambuc     ++a;
4042*0a6a1f1dSLionel Sambuc   }
4043*0a6a1f1dSLionel Sambuc 
4044*0a6a1f1dSLionel Sambuc // TASK DIRECTIVE
4045*0a6a1f1dSLionel Sambuc #pragma omp task
4046*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
4047*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4048*0a6a1f1dSLionel Sambuc     ;
4049*0a6a1f1dSLionel Sambuc #pragma omp task
4050*0a6a1f1dSLionel Sambuc #pragma omp simd
4051*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4052*0a6a1f1dSLionel Sambuc     ;
4053*0a6a1f1dSLionel Sambuc #pragma omp task
4054*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
4055*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4056*0a6a1f1dSLionel Sambuc     ;
4057*0a6a1f1dSLionel Sambuc #pragma omp task
4058*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
4059*0a6a1f1dSLionel Sambuc   {
4060*0a6a1f1dSLionel Sambuc     bar();
4061*0a6a1f1dSLionel Sambuc   }
4062*0a6a1f1dSLionel Sambuc #pragma omp task
4063*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a task region}}
4064*0a6a1f1dSLionel Sambuc   {
4065*0a6a1f1dSLionel Sambuc     bar();
4066*0a6a1f1dSLionel Sambuc   }
4067*0a6a1f1dSLionel Sambuc #pragma omp task
4068*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
4069*0a6a1f1dSLionel Sambuc   bar();
4070*0a6a1f1dSLionel Sambuc #pragma omp task
4071*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'task' region}}
4072*0a6a1f1dSLionel Sambuc   bar();
4073*0a6a1f1dSLionel Sambuc #pragma omp task
4074*0a6a1f1dSLionel Sambuc #pragma omp critical
4075*0a6a1f1dSLionel Sambuc   bar();
4076*0a6a1f1dSLionel Sambuc #pragma omp task
4077*0a6a1f1dSLionel Sambuc #pragma omp parallel for
4078*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4079*0a6a1f1dSLionel Sambuc     ;
4080*0a6a1f1dSLionel Sambuc #pragma omp task
4081*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
4082*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4083*0a6a1f1dSLionel Sambuc     ;
4084*0a6a1f1dSLionel Sambuc #pragma omp task
4085*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
4086*0a6a1f1dSLionel Sambuc   {
4087*0a6a1f1dSLionel Sambuc     bar();
4088*0a6a1f1dSLionel Sambuc   }
4089*0a6a1f1dSLionel Sambuc #pragma omp task
4090*0a6a1f1dSLionel Sambuc #pragma omp task
4091*0a6a1f1dSLionel Sambuc   {
4092*0a6a1f1dSLionel Sambuc     bar();
4093*0a6a1f1dSLionel Sambuc   }
4094*0a6a1f1dSLionel Sambuc #pragma omp task
4095*0a6a1f1dSLionel Sambuc   {
4096*0a6a1f1dSLionel Sambuc #pragma omp taskyield
4097*0a6a1f1dSLionel Sambuc     bar();
4098*0a6a1f1dSLionel Sambuc   }
4099*0a6a1f1dSLionel Sambuc #pragma omp task
4100*0a6a1f1dSLionel Sambuc   {
4101*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'task' region}}
4102*0a6a1f1dSLionel Sambuc     bar();
4103*0a6a1f1dSLionel Sambuc   }
4104*0a6a1f1dSLionel Sambuc #pragma omp task
4105*0a6a1f1dSLionel Sambuc   {
4106*0a6a1f1dSLionel Sambuc #pragma omp taskwait
4107*0a6a1f1dSLionel Sambuc     bar();
4108*0a6a1f1dSLionel Sambuc   }
4109*0a6a1f1dSLionel Sambuc #pragma omp task
4110*0a6a1f1dSLionel Sambuc   {
4111*0a6a1f1dSLionel Sambuc #pragma omp flush
4112*0a6a1f1dSLionel Sambuc     bar();
4113*0a6a1f1dSLionel Sambuc   }
4114*0a6a1f1dSLionel Sambuc #pragma omp task
4115*0a6a1f1dSLionel Sambuc   {
4116*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
4117*0a6a1f1dSLionel Sambuc     bar();
4118*0a6a1f1dSLionel Sambuc   }
4119*0a6a1f1dSLionel Sambuc #pragma omp task
4120*0a6a1f1dSLionel Sambuc   {
4121*0a6a1f1dSLionel Sambuc #pragma omp atomic
4122*0a6a1f1dSLionel Sambuc     ++a;
4123*0a6a1f1dSLionel Sambuc   }
4124*0a6a1f1dSLionel Sambuc #pragma omp task
4125*0a6a1f1dSLionel Sambuc   {
4126*0a6a1f1dSLionel Sambuc #pragma omp target
4127*0a6a1f1dSLionel Sambuc     ++a;
4128*0a6a1f1dSLionel Sambuc   }
4129*0a6a1f1dSLionel Sambuc #pragma omp task
4130*0a6a1f1dSLionel Sambuc   {
4131*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
4132*0a6a1f1dSLionel Sambuc     ++a;
4133*0a6a1f1dSLionel Sambuc   }
4134*0a6a1f1dSLionel Sambuc 
4135*0a6a1f1dSLionel Sambuc // ATOMIC DIRECTIVE
4136*0a6a1f1dSLionel Sambuc #pragma omp atomic
4137*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4138*0a6a1f1dSLionel Sambuc   {
4139*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4140*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
4141*0a6a1f1dSLionel Sambuc       ;
4142*0a6a1f1dSLionel Sambuc   }
4143*0a6a1f1dSLionel Sambuc #pragma omp atomic
4144*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4145*0a6a1f1dSLionel Sambuc   {
4146*0a6a1f1dSLionel Sambuc #pragma omp simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4147*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
4148*0a6a1f1dSLionel Sambuc       ;
4149*0a6a1f1dSLionel Sambuc   }
4150*0a6a1f1dSLionel Sambuc #pragma omp atomic
4151*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4152*0a6a1f1dSLionel Sambuc   {
4153*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4154*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
4155*0a6a1f1dSLionel Sambuc       ;
4156*0a6a1f1dSLionel Sambuc   }
4157*0a6a1f1dSLionel Sambuc #pragma omp atomic
4158*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4159*0a6a1f1dSLionel Sambuc   {
4160*0a6a1f1dSLionel Sambuc #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4161*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
4162*0a6a1f1dSLionel Sambuc       ;
4163*0a6a1f1dSLionel Sambuc   }
4164*0a6a1f1dSLionel Sambuc #pragma omp atomic
4165*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4166*0a6a1f1dSLionel Sambuc   {
4167*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4168*0a6a1f1dSLionel Sambuc     {
4169*0a6a1f1dSLionel Sambuc       bar();
4170*0a6a1f1dSLionel Sambuc     }
4171*0a6a1f1dSLionel Sambuc   }
4172*0a6a1f1dSLionel Sambuc #pragma omp atomic
4173*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4174*0a6a1f1dSLionel Sambuc   {
4175*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4176*0a6a1f1dSLionel Sambuc     {
4177*0a6a1f1dSLionel Sambuc       bar();
4178*0a6a1f1dSLionel Sambuc     }
4179*0a6a1f1dSLionel Sambuc   }
4180*0a6a1f1dSLionel Sambuc #pragma omp atomic
4181*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4182*0a6a1f1dSLionel Sambuc   {
4183*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4184*0a6a1f1dSLionel Sambuc     {
4185*0a6a1f1dSLionel Sambuc       bar();
4186*0a6a1f1dSLionel Sambuc     }
4187*0a6a1f1dSLionel Sambuc   }
4188*0a6a1f1dSLionel Sambuc #pragma omp atomic
4189*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4190*0a6a1f1dSLionel Sambuc   {
4191*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4192*0a6a1f1dSLionel Sambuc     {
4193*0a6a1f1dSLionel Sambuc       bar();
4194*0a6a1f1dSLionel Sambuc     }
4195*0a6a1f1dSLionel Sambuc   }
4196*0a6a1f1dSLionel Sambuc #pragma omp atomic
4197*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4198*0a6a1f1dSLionel Sambuc   {
4199*0a6a1f1dSLionel Sambuc #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4200*0a6a1f1dSLionel Sambuc     {
4201*0a6a1f1dSLionel Sambuc       bar();
4202*0a6a1f1dSLionel Sambuc     }
4203*0a6a1f1dSLionel Sambuc   }
4204*0a6a1f1dSLionel Sambuc #pragma omp atomic
4205*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4206*0a6a1f1dSLionel Sambuc   {
4207*0a6a1f1dSLionel Sambuc #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4208*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
4209*0a6a1f1dSLionel Sambuc       ;
4210*0a6a1f1dSLionel Sambuc   }
4211*0a6a1f1dSLionel Sambuc #pragma omp atomic
4212*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4213*0a6a1f1dSLionel Sambuc   {
4214*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4215*0a6a1f1dSLionel Sambuc     for (int i = 0; i < 10; ++i)
4216*0a6a1f1dSLionel Sambuc       ;
4217*0a6a1f1dSLionel Sambuc   }
4218*0a6a1f1dSLionel Sambuc #pragma omp atomic
4219*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4220*0a6a1f1dSLionel Sambuc   {
4221*0a6a1f1dSLionel Sambuc #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4222*0a6a1f1dSLionel Sambuc     {
4223*0a6a1f1dSLionel Sambuc       bar();
4224*0a6a1f1dSLionel Sambuc     }
4225*0a6a1f1dSLionel Sambuc   }
4226*0a6a1f1dSLionel Sambuc #pragma omp atomic
4227*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4228*0a6a1f1dSLionel Sambuc   {
4229*0a6a1f1dSLionel Sambuc #pragma omp task // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4230*0a6a1f1dSLionel Sambuc     {
4231*0a6a1f1dSLionel Sambuc       bar();
4232*0a6a1f1dSLionel Sambuc     }
4233*0a6a1f1dSLionel Sambuc   }
4234*0a6a1f1dSLionel Sambuc #pragma omp atomic
4235*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4236*0a6a1f1dSLionel Sambuc   {
4237*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4238*0a6a1f1dSLionel Sambuc     bar();
4239*0a6a1f1dSLionel Sambuc   }
4240*0a6a1f1dSLionel Sambuc #pragma omp atomic
4241*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4242*0a6a1f1dSLionel Sambuc   {
4243*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4244*0a6a1f1dSLionel Sambuc     bar();
4245*0a6a1f1dSLionel Sambuc   }
4246*0a6a1f1dSLionel Sambuc #pragma omp atomic
4247*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4248*0a6a1f1dSLionel Sambuc   {
4249*0a6a1f1dSLionel Sambuc #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4250*0a6a1f1dSLionel Sambuc     bar();
4251*0a6a1f1dSLionel Sambuc   }
4252*0a6a1f1dSLionel Sambuc #pragma omp atomic
4253*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4254*0a6a1f1dSLionel Sambuc   {
4255*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4256*0a6a1f1dSLionel Sambuc     bar();
4257*0a6a1f1dSLionel Sambuc   }
4258*0a6a1f1dSLionel Sambuc #pragma omp atomic
4259*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4260*0a6a1f1dSLionel Sambuc   {
4261*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4262*0a6a1f1dSLionel Sambuc     bar();
4263*0a6a1f1dSLionel Sambuc   }
4264*0a6a1f1dSLionel Sambuc #pragma omp atomic
4265*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4266*0a6a1f1dSLionel Sambuc   {
4267*0a6a1f1dSLionel Sambuc #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4268*0a6a1f1dSLionel Sambuc     ++a;
4269*0a6a1f1dSLionel Sambuc   }
4270*0a6a1f1dSLionel Sambuc #pragma omp atomic
4271*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4272*0a6a1f1dSLionel Sambuc   {
4273*0a6a1f1dSLionel Sambuc #pragma omp target // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4274*0a6a1f1dSLionel Sambuc     ++a;
4275*0a6a1f1dSLionel Sambuc   }
4276*0a6a1f1dSLionel Sambuc #pragma omp atomic
4277*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4278*0a6a1f1dSLionel Sambuc   {
4279*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4280*0a6a1f1dSLionel Sambuc     ++a;
4281*0a6a1f1dSLionel Sambuc   }
4282*0a6a1f1dSLionel Sambuc 
4283*0a6a1f1dSLionel Sambuc // TARGET DIRECTIVE
4284*0a6a1f1dSLionel Sambuc #pragma omp target
4285*0a6a1f1dSLionel Sambuc #pragma omp parallel
4286*0a6a1f1dSLionel Sambuc   bar();
4287*0a6a1f1dSLionel Sambuc #pragma omp target
4288*0a6a1f1dSLionel Sambuc #pragma omp for
4289*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4290*0a6a1f1dSLionel Sambuc     ;
4291*0a6a1f1dSLionel Sambuc #pragma omp target
4292*0a6a1f1dSLionel Sambuc #pragma omp simd
4293*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4294*0a6a1f1dSLionel Sambuc     ;
4295*0a6a1f1dSLionel Sambuc #pragma omp target
4296*0a6a1f1dSLionel Sambuc #pragma omp for simd
4297*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4298*0a6a1f1dSLionel Sambuc     ;
4299*0a6a1f1dSLionel Sambuc #pragma omp target
4300*0a6a1f1dSLionel Sambuc #pragma omp sections
4301*0a6a1f1dSLionel Sambuc   {
4302*0a6a1f1dSLionel Sambuc     bar();
4303*0a6a1f1dSLionel Sambuc   }
4304*0a6a1f1dSLionel Sambuc #pragma omp target
4305*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target region}}
4306*0a6a1f1dSLionel Sambuc   {
4307*0a6a1f1dSLionel Sambuc     bar();
4308*0a6a1f1dSLionel Sambuc   }
4309*0a6a1f1dSLionel Sambuc #pragma omp target
4310*0a6a1f1dSLionel Sambuc #pragma omp single
4311*0a6a1f1dSLionel Sambuc   bar();
4312*0a6a1f1dSLionel Sambuc 
4313*0a6a1f1dSLionel Sambuc #pragma omp target
4314*0a6a1f1dSLionel Sambuc #pragma omp master
4315*0a6a1f1dSLionel Sambuc   {
4316*0a6a1f1dSLionel Sambuc     bar();
4317*0a6a1f1dSLionel Sambuc   }
4318*0a6a1f1dSLionel Sambuc #pragma omp target
4319*0a6a1f1dSLionel Sambuc #pragma omp critical
4320*0a6a1f1dSLionel Sambuc   {
4321*0a6a1f1dSLionel Sambuc     bar();
4322*0a6a1f1dSLionel Sambuc   }
4323*0a6a1f1dSLionel Sambuc #pragma omp target
4324*0a6a1f1dSLionel Sambuc #pragma omp parallel for
4325*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4326*0a6a1f1dSLionel Sambuc     ;
4327*0a6a1f1dSLionel Sambuc #pragma omp target
4328*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
4329*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4330*0a6a1f1dSLionel Sambuc     ;
4331*0a6a1f1dSLionel Sambuc #pragma omp target
4332*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
4333*0a6a1f1dSLionel Sambuc   {
4334*0a6a1f1dSLionel Sambuc     bar();
4335*0a6a1f1dSLionel Sambuc   }
4336*0a6a1f1dSLionel Sambuc #pragma omp target
4337*0a6a1f1dSLionel Sambuc #pragma omp task
4338*0a6a1f1dSLionel Sambuc   {
4339*0a6a1f1dSLionel Sambuc     bar();
4340*0a6a1f1dSLionel Sambuc   }
4341*0a6a1f1dSLionel Sambuc #pragma omp target
4342*0a6a1f1dSLionel Sambuc   {
4343*0a6a1f1dSLionel Sambuc #pragma omp taskyield
4344*0a6a1f1dSLionel Sambuc     bar();
4345*0a6a1f1dSLionel Sambuc   }
4346*0a6a1f1dSLionel Sambuc #pragma omp target
4347*0a6a1f1dSLionel Sambuc   {
4348*0a6a1f1dSLionel Sambuc #pragma omp barrier
4349*0a6a1f1dSLionel Sambuc     bar();
4350*0a6a1f1dSLionel Sambuc   }
4351*0a6a1f1dSLionel Sambuc #pragma omp target
4352*0a6a1f1dSLionel Sambuc   {
4353*0a6a1f1dSLionel Sambuc #pragma omp taskwait
4354*0a6a1f1dSLionel Sambuc     bar();
4355*0a6a1f1dSLionel Sambuc   }
4356*0a6a1f1dSLionel Sambuc #pragma omp target
4357*0a6a1f1dSLionel Sambuc   {
4358*0a6a1f1dSLionel Sambuc #pragma omp flush
4359*0a6a1f1dSLionel Sambuc     bar();
4360*0a6a1f1dSLionel Sambuc   }
4361*0a6a1f1dSLionel Sambuc #pragma omp target
4362*0a6a1f1dSLionel Sambuc   {
4363*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
4364*0a6a1f1dSLionel Sambuc     bar();
4365*0a6a1f1dSLionel Sambuc   }
4366*0a6a1f1dSLionel Sambuc #pragma omp target
4367*0a6a1f1dSLionel Sambuc   {
4368*0a6a1f1dSLionel Sambuc #pragma omp atomic
4369*0a6a1f1dSLionel Sambuc     ++a;
4370*0a6a1f1dSLionel Sambuc   }
4371*0a6a1f1dSLionel Sambuc #pragma omp target
4372*0a6a1f1dSLionel Sambuc   {
4373*0a6a1f1dSLionel Sambuc #pragma omp target
4374*0a6a1f1dSLionel Sambuc     ++a;
4375*0a6a1f1dSLionel Sambuc   }
4376*0a6a1f1dSLionel Sambuc #pragma omp target
4377*0a6a1f1dSLionel Sambuc   {
4378*0a6a1f1dSLionel Sambuc #pragma omp teams
4379*0a6a1f1dSLionel Sambuc     ++a;
4380*0a6a1f1dSLionel Sambuc   }
4381*0a6a1f1dSLionel Sambuc #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
4382*0a6a1f1dSLionel Sambuc   {
4383*0a6a1f1dSLionel Sambuc     ++a;          // expected-note {{statement outside teams construct here}}
4384*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-note {{nested teams construct here}}
4385*0a6a1f1dSLionel Sambuc     ++a;
4386*0a6a1f1dSLionel Sambuc   }
4387*0a6a1f1dSLionel Sambuc 
4388*0a6a1f1dSLionel Sambuc // TEAMS DIRECTIVE
4389*0a6a1f1dSLionel Sambuc #pragma omp target
4390*0a6a1f1dSLionel Sambuc #pragma omp teams
4391*0a6a1f1dSLionel Sambuc #pragma omp parallel
4392*0a6a1f1dSLionel Sambuc   bar();
4393*0a6a1f1dSLionel Sambuc #pragma omp target
4394*0a6a1f1dSLionel Sambuc #pragma omp teams
4395*0a6a1f1dSLionel Sambuc #pragma omp for // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
4396*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4397*0a6a1f1dSLionel Sambuc     ;
4398*0a6a1f1dSLionel Sambuc #pragma omp target
4399*0a6a1f1dSLionel Sambuc #pragma omp teams
4400*0a6a1f1dSLionel Sambuc #pragma omp simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp simd' directive into a parallel region?}}
4401*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4402*0a6a1f1dSLionel Sambuc     ;
4403*0a6a1f1dSLionel Sambuc #pragma omp target
4404*0a6a1f1dSLionel Sambuc #pragma omp teams
4405*0a6a1f1dSLionel Sambuc #pragma omp for simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
4406*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4407*0a6a1f1dSLionel Sambuc     ;
4408*0a6a1f1dSLionel Sambuc #pragma omp target
4409*0a6a1f1dSLionel Sambuc #pragma omp teams
4410*0a6a1f1dSLionel Sambuc #pragma omp sections // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
4411*0a6a1f1dSLionel Sambuc   {
4412*0a6a1f1dSLionel Sambuc     bar();
4413*0a6a1f1dSLionel Sambuc   }
4414*0a6a1f1dSLionel Sambuc #pragma omp target
4415*0a6a1f1dSLionel Sambuc #pragma omp teams
4416*0a6a1f1dSLionel Sambuc #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams region}}
4417*0a6a1f1dSLionel Sambuc   {
4418*0a6a1f1dSLionel Sambuc     bar();
4419*0a6a1f1dSLionel Sambuc   }
4420*0a6a1f1dSLionel Sambuc #pragma omp target
4421*0a6a1f1dSLionel Sambuc #pragma omp teams
4422*0a6a1f1dSLionel Sambuc #pragma omp single // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
4423*0a6a1f1dSLionel Sambuc   bar();
4424*0a6a1f1dSLionel Sambuc 
4425*0a6a1f1dSLionel Sambuc #pragma omp target
4426*0a6a1f1dSLionel Sambuc #pragma omp teams
4427*0a6a1f1dSLionel Sambuc #pragma omp master // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp master' directive into a parallel region?}}
4428*0a6a1f1dSLionel Sambuc   {
4429*0a6a1f1dSLionel Sambuc     bar();
4430*0a6a1f1dSLionel Sambuc   }
4431*0a6a1f1dSLionel Sambuc #pragma omp target
4432*0a6a1f1dSLionel Sambuc #pragma omp teams
4433*0a6a1f1dSLionel Sambuc #pragma omp critical // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp critical' directive into a parallel region?}}
4434*0a6a1f1dSLionel Sambuc   {
4435*0a6a1f1dSLionel Sambuc     bar();
4436*0a6a1f1dSLionel Sambuc   }
4437*0a6a1f1dSLionel Sambuc #pragma omp target
4438*0a6a1f1dSLionel Sambuc #pragma omp teams
4439*0a6a1f1dSLionel Sambuc #pragma omp parallel for
4440*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4441*0a6a1f1dSLionel Sambuc     ;
4442*0a6a1f1dSLionel Sambuc #pragma omp target
4443*0a6a1f1dSLionel Sambuc #pragma omp teams
4444*0a6a1f1dSLionel Sambuc #pragma omp parallel for simd
4445*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i)
4446*0a6a1f1dSLionel Sambuc     ;
4447*0a6a1f1dSLionel Sambuc #pragma omp target
4448*0a6a1f1dSLionel Sambuc #pragma omp teams
4449*0a6a1f1dSLionel Sambuc #pragma omp parallel sections
4450*0a6a1f1dSLionel Sambuc   {
4451*0a6a1f1dSLionel Sambuc     bar();
4452*0a6a1f1dSLionel Sambuc   }
4453*0a6a1f1dSLionel Sambuc #pragma omp target
4454*0a6a1f1dSLionel Sambuc #pragma omp teams
4455*0a6a1f1dSLionel Sambuc #pragma omp task // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp task' directive into a parallel region?}}
4456*0a6a1f1dSLionel Sambuc   {
4457*0a6a1f1dSLionel Sambuc     bar();
4458*0a6a1f1dSLionel Sambuc   }
4459*0a6a1f1dSLionel Sambuc #pragma omp target
4460*0a6a1f1dSLionel Sambuc #pragma omp teams
4461*0a6a1f1dSLionel Sambuc   {
4462*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskyield' directive into a parallel region?}}
4463*0a6a1f1dSLionel Sambuc     bar();
4464*0a6a1f1dSLionel Sambuc   }
4465*0a6a1f1dSLionel Sambuc #pragma omp target
4466*0a6a1f1dSLionel Sambuc #pragma omp teams
4467*0a6a1f1dSLionel Sambuc   {
4468*0a6a1f1dSLionel Sambuc #pragma omp barrier // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp barrier' directive into a parallel region?}}
4469*0a6a1f1dSLionel Sambuc     bar();
4470*0a6a1f1dSLionel Sambuc   }
4471*0a6a1f1dSLionel Sambuc #pragma omp target
4472*0a6a1f1dSLionel Sambuc #pragma omp teams
4473*0a6a1f1dSLionel Sambuc   {
4474*0a6a1f1dSLionel Sambuc #pragma omp taskwait // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskwait' directive into a parallel region?}}
4475*0a6a1f1dSLionel Sambuc     bar();
4476*0a6a1f1dSLionel Sambuc   }
4477*0a6a1f1dSLionel Sambuc #pragma omp target
4478*0a6a1f1dSLionel Sambuc #pragma omp teams
4479*0a6a1f1dSLionel Sambuc   {
4480*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp flush' directive into a parallel region?}}
4481*0a6a1f1dSLionel Sambuc     bar();
4482*0a6a1f1dSLionel Sambuc   }
4483*0a6a1f1dSLionel Sambuc #pragma omp target
4484*0a6a1f1dSLionel Sambuc #pragma omp teams
4485*0a6a1f1dSLionel Sambuc   {
4486*0a6a1f1dSLionel Sambuc #pragma omp ordered // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
4487*0a6a1f1dSLionel Sambuc     bar();
4488*0a6a1f1dSLionel Sambuc   }
4489*0a6a1f1dSLionel Sambuc #pragma omp target
4490*0a6a1f1dSLionel Sambuc #pragma omp teams
4491*0a6a1f1dSLionel Sambuc   {
4492*0a6a1f1dSLionel Sambuc #pragma omp atomic // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp atomic' directive into a parallel region?}}
4493*0a6a1f1dSLionel Sambuc     ++a;
4494*0a6a1f1dSLionel Sambuc   }
4495*0a6a1f1dSLionel Sambuc #pragma omp target
4496*0a6a1f1dSLionel Sambuc #pragma omp teams
4497*0a6a1f1dSLionel Sambuc   {
4498*0a6a1f1dSLionel Sambuc #pragma omp target // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp target' directive into a parallel region?}}
4499*0a6a1f1dSLionel Sambuc     ++a;
4500*0a6a1f1dSLionel Sambuc   }
4501*0a6a1f1dSLionel Sambuc #pragma omp target
4502*0a6a1f1dSLionel Sambuc #pragma omp teams
4503*0a6a1f1dSLionel Sambuc   {
4504*0a6a1f1dSLionel Sambuc #pragma omp teams // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
4505*0a6a1f1dSLionel Sambuc     ++a;
4506*0a6a1f1dSLionel Sambuc   }
4507*0a6a1f1dSLionel Sambuc   return foo<int>();
4508*0a6a1f1dSLionel Sambuc }
4509*0a6a1f1dSLionel Sambuc 
4510