Skip to content

Commit dbe63e3

Browse files
authored
[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.
1 parent d639b91 commit dbe63e3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

clang/lib/CodeGen/CGStmt.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,8 @@ void CodeGenFunction::EmitStmt(const Stmt *S, ArrayRef<const Attr *> Attrs) {
414414
CGM.ErrorUnsupported(S, "OpenMP dispatch directive");
415415
break;
416416
case Stmt::OMPScopeDirectiveClass:
417-
llvm_unreachable("scope not supported with FE outlining");
417+
CGM.ErrorUnsupported(S, "scope with FE outlining");
418+
break;
418419
case Stmt::OMPMaskedDirectiveClass:
419420
EmitOMPMaskedDirective(cast<OMPMaskedDirective>(*S));
420421
break;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %clang_cc1 -emit-llvm -verify -fopenmp %s
2+
3+
int main () {
4+
int r = 0;
5+
#pragma omp scope reduction(+:r) // expected-error {{cannot compile this scope with FE outlining yet}}
6+
r++;
7+
return r;
8+
}

0 commit comments

Comments
 (0)