https://github.com/Puellaquae created https://github.com/llvm/llvm-project/pull/84135
Change unstable assertion into compilation error, and add a test for it. >From a2c88b0b615875d625b49e596886a0f5b32cf159 Mon Sep 17 00:00:00 2001 From: Puellaquae <shentuke...@hotmail.com> Date: Wed, 6 Mar 2024 05:22:08 +0000 Subject: [PATCH 1/2] [Clang][OpenMP] throw compilation error instead of crash in Stmt::OMPScopeDirectiveClass case (#77535) --- clang/lib/CodeGen/CGStmt.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index d0a3a716ad75e1..698986a3e49dd0 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; >From 52e4f0b996085b289d1550af06760e273c390996 Mon Sep 17 00:00:00 2001 From: Puellaquae <shentuke...@hotmail.com> Date: Wed, 6 Mar 2024 08:05:52 +0000 Subject: [PATCH 2/2] [Clang][OpenMP] add test for Stmt::OMPScopeDirectiveClass support error --- clang/test/OpenMP/error_unsupport_feature.c | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 clang/test/OpenMP/error_unsupport_feature.c diff --git a/clang/test/OpenMP/error_unsupport_feature.c b/clang/test/OpenMP/error_unsupport_feature.c new file mode 100644 index 00000000000000..a100300752db91 --- /dev/null +++ b/clang/test/OpenMP/error_unsupport_feature.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-obj -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; +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits