Skip to content

[flang][OpenMP] fix diagnostic for bad cancel type #140798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions flang/lib/Semantics/check-omp-structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2575,8 +2575,8 @@ void OmpStructureChecker::CheckCancellationNest(
}
break;
default:
// This should have been diagnosed by this point.
llvm_unreachable("Unexpected directive");
// This is diagnosed later.
return;
}
if (!eligibleCancellation) {
context_.Say(source,
Expand Down Expand Up @@ -2614,8 +2614,8 @@ void OmpStructureChecker::CheckCancellationNest(
parser::ToUpperCaseLetters(typeName.str()));
break;
default:
// This should have been diagnosed by this point.
llvm_unreachable("Unexpected directive");
// This is diagnosed later.
return;
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions flang/test/Semantics/OpenMP/cancel-bad-cancel-type.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
!RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags

program test
!ERROR: PARALLEL DO is not a cancellable construct
!$omp cancel parallel do
end