-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-c_unwind`#![feature(c_unwind)]``#![feature(c_unwind)]`I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
In the following code, test
should explicitly be allowed to unwind:
#![feature(c_unwind)]
extern "C-unwind" {
fn test();
}
fn main() {
unsafe { test(); }
}
However, when building this with -Cpanic=abort
, we generate LLVM IR as follows:
; Function Attrs: nounwind nonlazybind
declare void @test() unnamed_addr #1
This means unwinding of test
is UB, i.e., this is a soundness problem.
This most likely also affects #[unwind(allowed)]
, but that attribute is slated for removal anyway.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-c_unwind`#![feature(c_unwind)]``#![feature(c_unwind)]`I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.