Skip to content

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

Closed
@iximeow

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationC-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.O-x86_32Target: x86 processors, 32 bit (like i686-*) (IA-32)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions