LLVM sljl intrinsics segfaults

I am trying to get a working example of setjmp/longjmp LLVM intrinsics to run but the examples I have found online compile with a faulty jmp instruction that causes a segfault. The Rust in Action example fails (sorry discourse won't let me link). This is a minimal program I have set up on rust playground that also fails with a segfault. Just for reference, the sljl docs. I am curious if anyone has successfully used them in rust and has an example?

I have ran it with GDB and read through the asm but can't quite figure out what might be happening.

What the sjlj functions look like:

extern "C" {
    #[link_name = "llvm.eh.sjlj.setjmp"]
    pub fn setjmp(_: *mut i8) -> i32;

    #[link_name = "llvm.eh.sjlj.longjmp"]
    pub fn longjmp(_: *mut i8);

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.