Skip to content

#[lang="exchange_malloc"] seems to be broken #14460

Closed
@snare

Description

@snare

Adding the #[lang="exchange_malloc"] directive to a function causes an assertion failure in the compiler. Tested with the latest version (746d086)

$ cat ex.rs
#![no_std]
#![no_main]

#[no_split_stack]
#[no_mangle]
pub fn thing()->int {
    let y = box 10;
    0
}

#[lang="exchange_malloc"]
pub fn malloc(size: uint) -> *mut u8 {
    0 as *mut u8
}

$ rustc --crate-type=lib ex.rs
ex.rs:7:6: 7:7 warning: unused variable: `y`, #[warn(unused_variable)] on by default
ex.rs:7     let y = box 10;
                ^
ex.rs:12:15: 12:19 warning: unused variable: `size`, #[warn(unused_variable)] on by default
ex.rs:12 pub fn malloc(size: uint) -> *mut u8 {
                       ^~~~
Assertion failed: ((Args.size() == FTy->getNumParams() || (FTy->isVarArg() && Args.size() > FTy->getNumParams())) && "Calling a function with bad signature!"), function init, file /<redacted>/rust/src/llvm/lib/IR/Instructions.cpp, line 276.
zsh: abort      ~/rust/bin/rustc --crate-type=lib ex.rs     zsh: abort      rustc --crate-type=lib ex.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions