Skip to content

Miri doesn't understand C-variadic functions #1892

Open
@bugadani

Description

@bugadani

I have a program written in C and Rust. This program has a function that is variadic and written in C. To enable testing my Rust code, I needed to mock this function using the #[feature(c_variadic)] unstable feature.

This means I have a function in my test code defined like the following:

pub unsafe extern "C" fn variadic_fn(
        some_arg: *const c_char,
        mut args: ...
    ) {
...
}

When running Miri on my test code, I'm greeted with the following error:
error: Undefined Behavior: calling a function with argument of type std::ffi::VaListImpl passing data of type *const i8

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-interpreterArea: affects the core interpreterC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions