rust
rust copied to clipboard
SIGSEGV during compilation when taking address of extern x86-interrupt fn
#![feature(abi_x86_interrupt)]
#[repr(C)]
pub struct Context<'a> {
inner: &'a mut u8,
}
extern "x86-interrupt" fn isr(_: Context) { }
pub fn main() {
println!("oops: {:x}", isr as usize);
}
yields
> rustc crash.rs
Segmentation fault (core dumped)
Interestingly, it seems like #[repr(C)] is load-bearing? No crash without a repr on the argument type. Also no crash if the argument is zero-sized (even with #[repr(C)]).
It seems like this might be related to https://github.com/rust-lang/rust/issues/63018, where this is also resulting in nonsense IR to LLVM?
This no longer appears to crash?
yup, looks like this was fixed in the last few years:
[17:53:33] # iximeow:~> ./crash
oops: 55fa21ef0ad0
neat!