Skip to content

Phase 1 unwind failure when a Rust frame containing an aborting drop guard is called from code without unwinding info #110499

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

Open
nbdd0121 opened this issue Apr 18, 2023 · 0 comments
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nbdd0121
Copy link
Contributor

Spawn off from #109672

test.rs:

#[no_mangle]
extern "C" fn d() {
    struct Double;

    impl Drop for Double {
        fn drop(&mut self) {
            std::process::abort();
        }
    }

    let _d = Double;

    panic!("once");
}

test.c:

void d();

int main(void) {
    d();
}

compile with:

rustc -O test.rs --crate-type staticlib
gcc test.c libtest.a
./a.out

and I get:

thread '<unnamed>' panicked at 'once', test.rs:13:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
Aborted

cc @rust-lang/wg-ffi-unwind @nikic
@rustbot label: +T-compiler

@nbdd0121 nbdd0121 added the C-bug Category: This is a bug. label Apr 18, 2023
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 18, 2023
@nbdd0121 nbdd0121 changed the title Phase 1 unwind failure when a Rust frame contains an aborting drop guard is called from code without unwinding info Phase 1 unwind failure when a Rust frame containing an aborting drop guard is called from code without unwinding info Apr 18, 2023
@jyn514 jyn514 added the A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows label Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants