From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/codegen/catch-unwind.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/test/codegen/catch-unwind.rs (limited to 'src/test/codegen/catch-unwind.rs') diff --git a/src/test/codegen/catch-unwind.rs b/src/test/codegen/catch-unwind.rs new file mode 100644 index 000000000..3ea3a24bf --- /dev/null +++ b/src/test/codegen/catch-unwind.rs @@ -0,0 +1,29 @@ +// compile-flags: -O + +// On x86 the closure is inlined in foo() producing something like +// define i32 @foo() [...] { +// tail call void @bar() [...] +// ret i32 0 +// } +// On riscv the closure is another function, placed before fn foo so CHECK can't +// find it +// ignore-riscv64 FIXME + +#![crate_type = "lib"] +#![feature(c_unwind)] + +extern "C" { + fn bar(); +} + +// CHECK-LABEL: @foo +#[no_mangle] +pub unsafe fn foo() -> i32 { + // CHECK: call void @bar + // CHECK: ret i32 0 + std::panic::catch_unwind(|| { + bar(); + 0 + }) + .unwrap() +} -- cgit v1.2.3