[flang-commits] [flang] f054aa2 - [flang][OpenMP] fix diagnostic for bad cancel type (#140798)
via flang-commits
flang-commits at lists.llvm.org
Wed May 21 02:48:16 PDT 2025
Author: Tom Eccles
Date: 2025-05-21T10:48:13+01:00
New Revision: f054aa240f4205873a1d2bb6da3e453007be8ba6
URL: https://github.com/llvm/llvm-project/commit/f054aa240f4205873a1d2bb6da3e453007be8ba6
DIFF: https://github.com/llvm/llvm-project/commit/f054aa240f4205873a1d2bb6da3e453007be8ba6.diff
LOG: [flang][OpenMP] fix diagnostic for bad cancel type (#140798)
Fixes #133685
Added:
flang/test/Semantics/OpenMP/cancel-bad-cancel-type.f90
Modified:
flang/lib/Semantics/check-omp-structure.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index c6c4fdf8a8198..606014276e7ca 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -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,
@@ -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;
}
}
}
diff --git a/flang/test/Semantics/OpenMP/cancel-bad-cancel-type.f90 b/flang/test/Semantics/OpenMP/cancel-bad-cancel-type.f90
new file mode 100644
index 0000000000000..ea5e7be23e2f9
--- /dev/null
+++ b/flang/test/Semantics/OpenMP/cancel-bad-cancel-type.f90
@@ -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
More information about the flang-commits
mailing list