Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ice: too many arguments to fn_ptr: log (got 2 args, expected 1) #298

Open
matthiaskrgr opened this issue Jul 1, 2023 · 1 comment
Open

Comments

@matthiaskrgr
Copy link
Member

//! Issue #56309

extern "C" {
    fn log(message_data: u32, message_size: u32);
}

pub fn main() {
    let message = "Hello, world!";
    unsafe {
        log(message.as_ptr() as u32, message.len() as u32);
    }
}
libgccjit.so: error: gcc_jit_context_new_call_through_ptr: too many arguments to fn_ptr: log (got 2 args, expected 1)
gcc_jit_rvalue_get_type: NULL rvalue
libgccjit.so: error: gcc_jit_function_new_local: NULL type
libgccjit.so: error: gcc_jit_block_add_assignment: NULL lvalue
gcc_jit_lvalue_as_rvalue: NULL lvalue
@bjorn3
Copy link
Member

bjorn3 commented Jul 1, 2023

log is a function in libm. Gcc likely has it pre-declared with the same signature as the libm version to be able to replace it with a faster version at compile time. LLVM has the exact samw problem as I understand it. And in the past it also used to have to be an issue when #[link(wasm_import_module)] was used to import from a non-default module: rust-lang/rust#56309 The test is not meant to work outside of webassembly with #[link(wasm_import_module)]. https://github.com/rust-lang/rust/blob/e5bb341f0e1db4e4407f129d9834f9ada2030b7c/tests/run-make/wasm-symbols-different-module/log.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants