Skip to content

inline-asm immediate constraint with fn argument crashes LLVM #51130

Closed
@roblabla

Description

@roblabla
#![feature(asm)]
fn main() {
    unsafe { asm!("call $0" :: "i"(test) :: "intel"); }
}
extern fn test() {}

For some reason, this crashes rustc. However, the following test compiles properly in some cases:

#![feature(asm)]
fn main() {
    unsafe { asm!("call $0" :: "i"(test as *const u8) :: "intel"); }
}
extern fn test() {}

But, in a real world project, the exact same code I get errors such as error: invalid operand for inline asm constraint 'i' or compile-time segfaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inline-assemblyArea: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.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