@@ -113,3 +113,200 @@ void Return() {
113
113
}
114
114
}
115
115
}
116
+
117
+ void Goto () {
118
+ int j ;
119
+ #pragma acc parallel // expected-note{{invalid branch out of OpenACC Compute Construct}}
120
+ while (j ) {
121
+ if (j < 3 )
122
+ goto LABEL ; // expected-error{{cannot jump from this goto statement to its label}}
123
+ }
124
+
125
+ LABEL :
126
+ {}
127
+
128
+ goto LABEL_IN ; // expected-error{{cannot jump from this goto statement to its label}}
129
+
130
+ #pragma acc parallel // expected-note{{invalid branch into OpenACC Compute Construct}}
131
+ for (int i = 0 ; i < 5 ; ++ i ) {
132
+ LABEL_IN :
133
+ {}
134
+ }
135
+
136
+ #pragma acc parallel
137
+ for (int i = 0 ; i < 5 ; ++ i ) {
138
+ LABEL_NOT_CALLED :
139
+ {}
140
+ }
141
+
142
+ #pragma acc parallel
143
+ {
144
+ goto ANOTHER_LOOP ; // expected-error{{cannot jump from this goto statement to its label}}
145
+
146
+ }
147
+ #pragma acc parallel// expected-note{{invalid branch into OpenACC Compute Construct}}
148
+
149
+ {
150
+ ANOTHER_LOOP :
151
+ {}
152
+ }
153
+
154
+ #pragma acc parallel
155
+ {
156
+ while (j ) {
157
+ -- j ;
158
+ if (j < 3 )
159
+ goto LABEL2 ;
160
+
161
+ if (j > 4 )
162
+ break ;
163
+ }
164
+ LABEL2 :
165
+ {}
166
+ }
167
+
168
+ #pragma acc parallel
169
+ do {
170
+ if (j < 3 )
171
+ goto LABEL3 ;
172
+
173
+ if (j > 4 )
174
+ break ; // expected-error{{invalid branch out of OpenACC Compute Construct}}
175
+
176
+ LABEL3 :
177
+ {}
178
+ } while (j );
179
+
180
+ LABEL4 :
181
+ {}
182
+ #pragma acc parallel// expected-note{{invalid branch out of OpenACC Compute Construct}}
183
+ {
184
+ goto LABEL4 ;// expected-error{{cannot jump from this goto statement to its label}}
185
+ }
186
+
187
+ #pragma acc parallel// expected-note{{invalid branch into OpenACC Compute Construct}}
188
+
189
+ {
190
+ LABEL5 :
191
+ {}
192
+ }
193
+
194
+ {
195
+ goto LABEL5 ;// expected-error{{cannot jump from this goto statement to its label}}
196
+ }
197
+
198
+ #pragma acc parallel
199
+ {
200
+ LABEL6 :
201
+ {}
202
+ goto LABEL6 ;
203
+
204
+ }
205
+
206
+ #pragma acc parallel
207
+ goto LABEL7 ; // expected-error{{cannot jump from this goto statement to its label}}
208
+ #pragma acc parallel// expected-note{{invalid branch into OpenACC Compute Construct}}
209
+ {
210
+ LABEL7 :{}
211
+ }
212
+
213
+ #pragma acc parallel
214
+ LABEL8 :{}
215
+ #pragma acc parallel// expected-note{{invalid branch out of OpenACC Compute Construct}}
216
+ {
217
+ goto LABEL8 ;// expected-error{{cannot jump from this goto statement to its label}}
218
+ }
219
+
220
+
221
+ #pragma acc parallel// expected-note{{invalid branch into OpenACC Compute Construct}}
222
+ {
223
+ LABEL9 :{}
224
+ }
225
+
226
+ ({goto LABEL9 ;});// expected-error{{cannot jump from this goto statement to its label}}
227
+
228
+ #pragma acc parallel// expected-note{{invalid branch out of OpenACC Compute Construct}}
229
+ {
230
+ ({goto LABEL10 ;});// expected-error{{cannot jump from this goto statement to its label}}
231
+ }
232
+
233
+ LABEL10 :{}
234
+
235
+ ({goto LABEL11 ;});// expected-error{{cannot jump from this goto statement to its label}}
236
+ #pragma acc parallel// expected-note{{invalid branch into OpenACC Compute Construct}}
237
+ {
238
+ LABEL11 :{}
239
+ }
240
+
241
+ LABEL12 :{}
242
+ #pragma acc parallel// expected-note{{invalid branch out of OpenACC Compute Construct}}
243
+ {
244
+ ({goto LABEL12 ;});// expected-error{{cannot jump from this goto statement to its label}}
245
+ }
246
+
247
+ #pragma acc parallel
248
+ {
249
+ ({goto LABEL13 ;});
250
+ LABEL13 :{}
251
+ }
252
+
253
+ #pragma acc parallel
254
+ {
255
+ LABEL14 :{}
256
+ ({goto LABEL14 ;});
257
+ }
258
+ }
259
+
260
+ void IndirectGoto1 () {
261
+ void * ptr ;
262
+ #pragma acc parallel
263
+ {
264
+ LABEL1 :{}
265
+ ptr = & & LABEL1 ;
266
+
267
+ goto * ptr ;
268
+
269
+ }
270
+ }
271
+
272
+ void IndirectGoto2 () {
273
+ void * ptr ;
274
+ LABEL2 :{} // #GOTOLBL2
275
+ ptr = & & LABEL2 ;
276
+ #pragma acc parallel // #GOTOPAR2
277
+ {
278
+ // expected-error@+3{{cannot jump from this indirect goto statement to one of its possible targets}}
279
+ // expected-note@#GOTOLBL2{{possible target of indirect goto statement}}
280
+ // expected-note@#GOTOPAR2{{invalid branch out of OpenACC Compute Construct}}
281
+ goto * ptr ;
282
+ }
283
+ }
284
+
285
+ void IndirectGoto3 () {
286
+ void * ptr ;
287
+ #pragma acc parallel // #GOTOPAR3
288
+ {
289
+ LABEL3 :{} // #GOTOLBL3
290
+ ptr = & & LABEL3 ;
291
+ }
292
+ // expected-error@+3{{cannot jump from this indirect goto statement to one of its possible targets}}
293
+ // expected-note@#GOTOLBL3{{possible target of indirect goto statement}}
294
+ // expected-note@#GOTOPAR3{{invalid branch into OpenACC Compute Construct}}
295
+ goto * ptr ;
296
+ }
297
+
298
+ void IndirectGoto4 () {
299
+ void * ptr ;
300
+ #pragma acc parallel // #GOTOPAR4
301
+ {
302
+ LABEL4 :{}
303
+ ptr = & & LABEL4 ;
304
+ // expected-error@+3{{cannot jump from this indirect goto statement to one of its possible targets}}
305
+ // expected-note@#GOTOLBL5{{possible target of indirect goto statement}}
306
+ // expected-note@#GOTOPAR4{{invalid branch out of OpenACC Compute Construct}}
307
+ goto * ptr ;
308
+ }
309
+ LABEL5 :// #GOTOLBL5
310
+
311
+ ptr = & & LABEL5 ;
312
+ }
0 commit comments