Skip to content

SIGSEGV during compilation when taking address of extern x86-interrupt fn #67674

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

Closed
iximeow opened this issue Dec 28, 2019 · 3 comments
Closed
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-x86_32 Target: x86 processors, 32 bit (like i686-*) (IA-32) requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@iximeow
Copy link
Contributor

iximeow commented Dec 28, 2019

#![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)]).

@iximeow
Copy link
Contributor Author

iximeow commented Dec 28, 2019

It seems like this might be related to #63018, where this is also resulting in nonsense IR to LLVM?

@jonas-schievink jonas-schievink added A-codegen Area: Code generation C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. O-x86 labels Dec 28, 2019
@workingjubilee
Copy link
Member

This no longer appears to crash?

@iximeow
Copy link
Contributor Author

iximeow commented Oct 22, 2022

yup, looks like this was fixed in the last few years:

[17:53:33] # iximeow:~> ./crash
oops: 55fa21ef0ad0

neat!

@iximeow iximeow closed this as completed Oct 22, 2022
@Noratrieb Noratrieb added O-x86_32 Target: x86 processors, 32 bit (like i686-*) (IA-32) and removed O-x86-all labels Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-x86_32 Target: x86 processors, 32 bit (like i686-*) (IA-32) requires-nightly This issue requires a nightly compiler in some way. 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

4 participants