Debian Codegraph @

gcc/testsuite/rust/compile/try-catch-unwind-old.rs

raw
1 // { dg-options "-O2 -w -fdump-tree-optimized" }
2 #![feature(intrinsics)]
3
4 extern "rust-intrinsic" {
5 // { dg-final { scan-tree-dump-times "__builtin_eh_pointer" 1 "optimized" } }
6 fn r#try(try_fn: fn(_: *mut u8), data: *mut u8, catch_fn: fn(_: *mut u8, _: *mut u8)) -> i32;
7 }
8
9 extern "C" {
10 fn try_fn(data: *mut u8);
11 fn catch_fn(data: *mut u8, ex: *mut u8);
12 }
13
14 pub fn not_main(d: &mut u8) -> i32 {
15 unsafe {
16 // { dg-final { scan-tree-dump-times "try_fn" 1 "optimized" } }
17 let _: i32 = r#try(try_fn, d, catch_fn);
18 // { dg-final { scan-tree-dump-times "catch_fn" 1 "optimized" } }
19 }
20 42
21 }