Skip to content

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

Closed

Description

@matthiaskrgr
//! 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

Activity

  1. bjorn3 commented on Jul 1, 2023

    @bjorn3
    Member

    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

  2. antoyo commented on Sep 24, 2025

    @antoyo
    Contributor

    I believe this is fixed now.
    Are you able to reproduce?

  3. GuillaumeGomez commented on Jan 30, 2026

    @GuillaumeGomez
    Member

    I opened #847 to ensure it.

  4. added a commit that references this issue on Feb 25, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions