Fix broken MinGW build of gcc.c
[official-gcc.git] / gcc / testsuite / gcc.dg / gomp / nesting-1.c
blob52fcda741ea0e30ab14bdffb9ad3b536aaffb204
1 /* { dg-do compile } */
2 /* { dg-options "-fopenmp" } */
4 void
5 f1 (void)
7 int i, j;
8 #pragma omp for
9 for (i = 0; i < 3; i++)
11 #pragma omp for /* { dg-error "may not be closely nested" } */
12 for (j = 0; j < 3; j++)
14 #pragma omp sections /* { dg-error "may not be closely nested" } */
17 #pragma omp section
20 #pragma omp single /* { dg-error "may not be closely nested" } */
22 #pragma omp master /* { dg-error "may not be closely nested" } */
24 #pragma omp barrier /* { dg-error "may not be closely nested" } */
26 #pragma omp sections
28 #pragma omp for /* { dg-error "may not be closely nested" } */
29 for (j = 0; j < 3; j++)
32 #pragma omp sections
34 #pragma omp sections /* { dg-error "may not be closely nested" } */
37 #pragma omp section
41 #pragma omp sections
43 #pragma omp single /* { dg-error "may not be closely nested" } */
46 #pragma omp sections
48 #pragma omp master /* { dg-error "may not be closely nested" } */
51 #pragma omp sections
53 #pragma omp section
56 #pragma omp sections
58 #pragma omp section
59 #pragma omp for /* { dg-error "may not be closely nested" } */
60 for (j = 0; j < 3; j++)
63 #pragma omp sections
65 #pragma omp section
66 #pragma omp sections /* { dg-error "may not be closely nested" } */
69 #pragma omp section
73 #pragma omp sections
75 #pragma omp section
76 #pragma omp single /* { dg-error "may not be closely nested" } */
79 #pragma omp sections
81 #pragma omp section
82 #pragma omp master /* { dg-error "may not be closely nested" } */
85 #pragma omp single
87 #pragma omp for /* { dg-error "may not be closely nested" } */
88 for (j = 0; j < 3; j++)
90 #pragma omp sections /* { dg-error "may not be closely nested" } */
93 #pragma omp section
96 #pragma omp single /* { dg-error "may not be closely nested" } */
98 #pragma omp master /* { dg-error "may not be closely nested" } */
100 #pragma omp barrier /* { dg-error "may not be closely nested" } */
102 #pragma omp master
104 #pragma omp for /* { dg-error "may not be closely nested" } */
105 for (j = 0; j < 3; j++)
107 #pragma omp sections /* { dg-error "may not be closely nested" } */
110 #pragma omp section
113 #pragma omp single /* { dg-error "may not be closely nested" } */
115 #pragma omp master
117 #pragma omp barrier /* { dg-error "may not be closely nested" } */
119 #pragma omp task
121 #pragma omp for /* { dg-error "may not be closely nested" } */
122 for (j = 0; j < 3; j++)
124 #pragma omp sections /* { dg-error "may not be closely nested" } */
127 #pragma omp section
130 #pragma omp single /* { dg-error "may not be closely nested" } */
132 #pragma omp master /* { dg-error "may not be closely nested" } */
134 #pragma omp barrier /* { dg-error "may not be closely nested" } */
136 #pragma omp parallel
138 #pragma omp for
139 for (j = 0; j < 3; j++)
141 #pragma omp sections
144 #pragma omp section
147 #pragma omp single
149 #pragma omp master
151 #pragma omp barrier
155 void
156 f2 (void)
158 int i, j;
159 #pragma omp ordered
161 #pragma omp for /* { dg-error "may not be closely nested" } */
162 for (j = 0; j < 3; j++)
164 #pragma omp sections /* { dg-error "may not be closely nested" } */
167 #pragma omp section
170 #pragma omp single /* { dg-error "may not be closely nested" } */
172 #pragma omp master
174 #pragma omp barrier /* { dg-error "may not be closely nested" } */
178 void
179 f3 (void)
181 #pragma omp critical
183 #pragma omp ordered /* { dg-error "may not be closely nested" } */
188 void
189 f4 (void)
191 #pragma omp task
193 #pragma omp ordered /* { dg-error "may not be closely nested" } */
198 void
199 f5 (void)
201 int i;
202 #pragma omp for
203 for (i = 0; i < 10; i++)
205 #pragma omp ordered /* { dg-error "must be closely nested" } */
208 #pragma omp for ordered
209 for (i = 0; i < 10; i++)
211 #pragma omp ordered
216 void
217 f6 (void)
219 #pragma omp critical (foo)
220 #pragma omp critical (bar)
222 #pragma omp critical
223 #pragma omp critical (baz)
227 void
228 f7 (void)
230 #pragma omp critical (foo2)
231 #pragma omp critical
233 #pragma omp critical (bar)
234 #pragma omp critical (bar) /* { dg-error "may not be nested" } */
236 #pragma omp critical
237 #pragma omp critical /* { dg-error "may not be nested" } */