File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -218,13 +218,18 @@ void AccStructureChecker::Leave(const parser::OpenACCCombinedConstruct &x) {
218
218
const auto &beginBlockDir{std::get<parser::AccBeginCombinedDirective>(x.t )};
219
219
const auto &combinedDir{
220
220
std::get<parser::AccCombinedDirective>(beginBlockDir.t )};
221
+ auto &doCons{std::get<std::optional<parser::DoConstruct>>(x.t )};
221
222
switch (combinedDir.v ) {
222
223
case llvm::acc::Directive::ACCD_kernels_loop:
223
224
case llvm::acc::Directive::ACCD_parallel_loop:
224
225
case llvm::acc::Directive::ACCD_serial_loop:
225
226
// Restriction - line 1004-1005
226
227
CheckOnlyAllowedAfter (llvm::acc::Clause::ACCC_device_type,
227
228
computeConstructOnlyAllowedAfterDeviceTypeClauses);
229
+ if (doCons) {
230
+ const parser::Block &block{std::get<parser::Block>(doCons->t )};
231
+ CheckNoBranching (block, GetContext ().directive , beginBlockDir.source );
232
+ }
228
233
break ;
229
234
default :
230
235
break ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ program bug47659
9
9
! $acc parallel loop
10
10
do j = 1 , 10
11
11
if (j == 2 ) then
12
- exit label1
12
+ stop 1
13
13
end if
14
14
end do
15
15
end do label1
Original file line number Diff line number Diff line change @@ -19,6 +19,27 @@ subroutine openacc_clause_validity
19
19
end do
20
20
! $acc end parallel
21
21
22
+ ! $acc parallel loop
23
+ do i = 1 , N
24
+ a(i) = 3.14
25
+ ! ERROR: RETURN statement is not allowed in a PARALLEL LOOP construct
26
+ return
27
+ end do
28
+
29
+ ! $acc serial loop
30
+ do i = 1 , N
31
+ a(i) = 3.14
32
+ ! ERROR: RETURN statement is not allowed in a SERIAL LOOP construct
33
+ return
34
+ end do
35
+
36
+ ! $acc kernels loop
37
+ do i = 1 , N
38
+ a(i) = 3.14
39
+ ! ERROR: RETURN statement is not allowed in a KERNELS LOOP construct
40
+ return
41
+ end do
42
+
22
43
! $acc parallel
23
44
! $acc loop
24
45
do i = 1 , N
You can’t perform that action at this time.
0 commit comments