Skip to content

ICE: gcc_jit_context_new_call_through_ptr: not enough arguments to fn_ptr #836

@matthiaskrgr

Description

@matthiaskrgr

snippet:

//@compile-flags: -Zcodegen-backend=gcc -Clink-dead-code=true --crate-type=lib
extern "C" fn third(_a: usize, b: usize, c: usize) {
    let throw_away_f: fn((), usize, usize) =
        unsafe { std::mem::transmute(third as extern "C" fn(_, _, _)) };
    throw_away_f((), 2, 3)
}

Version information

rustc 1.95.0-nightly (a18e6d9d1 2026-01-24)
binary: rustc
commit-hash: a18e6d9d1473d9b25581dd04bef6c7577999631c
commit-date: 2026-01-24
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 21.1.8

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcodegen-backend=gcc -Clink-dead-code=true --crate-type=lib

Program output

warning: unused variable: `b`
 --> /tmp/icemaker_global_tempdir.CBsLkoeTYAlI/rustc_testrunner_tmpdir_reporting.Dz5kKkoF2a7R/mvce.rs:1:32
  |
1 | extern "C" fn third(_a: usize, b: usize, c: usize) {
  |                                ^ help: if this is intentional, prefix it with an underscore: `_b`
  |
  = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default

warning: unused variable: `c`
 --> /tmp/icemaker_global_tempdir.CBsLkoeTYAlI/rustc_testrunner_tmpdir_reporting.Dz5kKkoF2a7R/mvce.rs:1:42
  |
1 | extern "C" fn third(_a: usize, b: usize, c: usize) {
  |                                          ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: function `third` is never used
 --> /tmp/icemaker_global_tempdir.CBsLkoeTYAlI/rustc_testrunner_tmpdir_reporting.Dz5kKkoF2a7R/mvce.rs:1:15
  |
1 | extern "C" fn third(_a: usize, b: usize, c: usize) {
  |               ^^^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

libgccjit.so: error: : gcc_jit_context_new_call_through_ptr: not enough arguments to fn_ptr: _RNvCslo6T07L1JGf_4mvce5third (got 2 args, expected 3)
libgccjit.so: error: : gcc_jit_block_add_eval: NULL rvalue
error: failed to build archive at `outputfile`: failed to open object file: No such file or directory (os error 2)

error: aborting due to 1 previous error; 3 warnings emitted


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions