Skip to content

Commit f054aa2

Browse files
authored
[flang][OpenMP] fix diagnostic for bad cancel type (#140798)
Fixes #133685
1 parent 80913b4 commit f054aa2

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

flang/lib/Semantics/check-omp-structure.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2575,8 +2575,8 @@ void OmpStructureChecker::CheckCancellationNest(
25752575
}
25762576
break;
25772577
default:
2578-
// This should have been diagnosed by this point.
2579-
llvm_unreachable("Unexpected directive");
2578+
// This is diagnosed later.
2579+
return;
25802580
}
25812581
if (!eligibleCancellation) {
25822582
context_.Say(source,
@@ -2614,8 +2614,8 @@ void OmpStructureChecker::CheckCancellationNest(
26142614
parser::ToUpperCaseLetters(typeName.str()));
26152615
break;
26162616
default:
2617-
// This should have been diagnosed by this point.
2618-
llvm_unreachable("Unexpected directive");
2617+
// This is diagnosed later.
2618+
return;
26192619
}
26202620
}
26212621
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
!RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
2+
3+
program test
4+
!ERROR: PARALLEL DO is not a cancellable construct
5+
!$omp cancel parallel do
6+
end

0 commit comments

Comments
 (0)