aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
authorPuelloc <shentukeqin@hotmail.com>2024-06-10 05:29:41 +0800
committerGitHub <noreply@github.com>2024-06-09 14:29:41 -0700
commitdbe63e3d4dc9e4a53c95a6f8fd24c071d0a603e2 (patch)
tree61f5100754c9e305aa3f04b2af7daa4ce14ab900 /clang
parentd639b91bb26ed24d612953cf132605531c616c72 (diff)
downloadllvm-dbe63e3d4dc9e4a53c95a6f8fd24c071d0a603e2.zip
llvm-dbe63e3d4dc9e4a53c95a6f8fd24c071d0a603e2.tar.gz
llvm-dbe63e3d4dc9e4a53c95a6f8fd24c071d0a603e2.tar.bz2
[Clang][OpenMP] throw compilation error instead of crash in Stmt::OMPScopeDirectiveClass case (#77535) (#84135)
Fix #77535, Change unstable assertion into compilation error, and add a test for it.
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp3
-rw-r--r--clang/test/OpenMP/error_unsupport_feature.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 41ac511..39222c0 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -414,7 +414,8 @@ void CodeGenFunction::EmitStmt(const Stmt *S, ArrayRef<const Attr *> Attrs) {
CGM.ErrorUnsupported(S, "OpenMP dispatch directive");
break;
case Stmt::OMPScopeDirectiveClass:
- llvm_unreachable("scope not supported with FE outlining");
+ CGM.ErrorUnsupported(S, "scope with FE outlining");
+ break;
case Stmt::OMPMaskedDirectiveClass:
EmitOMPMaskedDirective(cast<OMPMaskedDirective>(*S));
break;
diff --git a/clang/test/OpenMP/error_unsupport_feature.c b/clang/test/OpenMP/error_unsupport_feature.c
new file mode 100644
index 0000000..611a8b4
--- /dev/null
+++ b/clang/test/OpenMP/error_unsupport_feature.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm -verify -fopenmp %s
+
+int main () {
+ int r = 0;
+#pragma omp scope reduction(+:r) // expected-error {{cannot compile this scope with FE outlining yet}}
+ r++;
+ return r;
+}