Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only pop a cleanup scope in ~TaskFrameScope if one was pushed #268

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGCilk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ CodeGenFunction::TaskFrameScope::TaskFrameScope(CodeGenFunction &CGF)
CodeGenFunction::TaskFrameScope::~TaskFrameScope() {
if (LangOptions::Cilk_none == CGF.getLangOpts().getCilk())
return;
if (!CGF.CurSyncRegion)
if (!TaskFrame)
return;

// Pop the taskframe.
Expand Down
15 changes: 15 additions & 0 deletions clang/test/Cilk/266.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// RUN: %clang_cc1 -triple x86_64-apple-macosx14.0.0 -emit-llvm -S -fopencilk -disable-llvm-passes -fcxx-exceptions -fexceptions -x c++ %s -o /dev/null
// expected-no-diagnostics
// Bug 266: unnecessary sync in catch block crashes compiler

extern int f();

// Nothing really to check here. If it compiles, great.
void try_catch() {
try {
f();
} catch (int x) {
_Cilk_sync;
}
}

Loading