Skip to content

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

Closed
@iximeow

Description

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

Activity

iximeow

iximeow commented on Dec 28, 2019

@iximeow
ContributorAuthor

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

added
A-codegenArea: Code generation
C-bugCategory: This is a bug.
I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
requires-nightlyThis issue requires a nightly compiler in some way.
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Dec 28, 2019
workingjubilee

workingjubilee commented on Aug 6, 2022

@workingjubilee
Member

This no longer appears to crash?

iximeow

iximeow commented on Oct 22, 2022

@iximeow
ContributorAuthor

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

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

neat!

added
O-x86_32Target: x86 processors, 32 bit (like i686-*) (IA-32)
and removed on Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @jonas-schievink@iximeow@workingjubilee@Noratrieb

        Issue actions

          SIGSEGV during compilation when taking address of extern x86-interrupt fn · Issue #67674 · rust-lang/rust