Author: Puelloc Date: 2024-06-09T14:29:41-07:00 New Revision: dbe63e3d4dc9e4a53c95a6f8fd24c071d0a603e2
URL: https://github.com/llvm/llvm-project/commit/dbe63e3d4dc9e4a53c95a6f8fd24c071d0a603e2 DIFF: https://github.com/llvm/llvm-project/commit/dbe63e3d4dc9e4a53c95a6f8fd24c071d0a603e2.diff LOG: [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. Added: clang/test/OpenMP/error_unsupport_feature.c Modified: clang/lib/CodeGen/CGStmt.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 41ac511c52f51..39222c0e65353 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 0000000000000..611a8b4639c44 --- /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; +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits