Skip to content

ICE gcc_jit_context_new_call: NULL function #831

@matthiaskrgr

Description

@matthiaskrgr

snippet:

//@compile-flags: -Zcodegen-backend=gcc
#![feature(float_minimum_maximum)]
#![warn(clippy::confusing_method_to_numeric_cast)]

fn main() {
    let _ = f32::max as usize; //~ confusing_method_to_numeric_cast
    let _ = u16::min as usize; //~ confusing_method_to_numeric_cast
    let _ = u16::max as usize; //~ confusing_method_to_numeric_cast
    let _ = u16::min as usize; //~ confusing_method_to_numeric_cast

    let _ = u16::min as usize; //~ confusing_method_to_numeric_cast
    let _ = f32::max as usize; //~ confusing_method_to_numeric_cast
    let _ = f32::minimum as usize; //~ confusing_method_to_numeric_cast
     _ = f32::min as usize; //~ confusing_method_to_numeric_cast
}

Version information

rustc 1.95.0-nightly (87b272187 2026-01-24)
binary: rustc
commit-hash: 87b272187129343c0efc8f92d253c16958aeac0b
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

Program output

warning: direct cast of function item into an integer
 --> /tmp/icemaker_global_tempdir.VtLBlWJ2MPJE/rustc_testrunner_tmpdir_reporting.P9jFXQ1qk9bF/mvce.rs:5:22
  |
5 |     let _ = f32::max as usize; //~ confusing_method_to_numeric_cast
  |                      ^^^^^^^^
  |
  = note: `#[warn(function_casts_as_integer)]` on by default
help: first cast to a pointer `as *const ()`
  |
5 |     let _ = f32::max as *const () as usize; //~ confusing_method_to_numeric_cast
  |                      ++++++++++++

warning: direct cast of function item into an integer
 --> /tmp/icemaker_global_tempdir.VtLBlWJ2MPJE/rustc_testrunner_tmpdir_reporting.P9jFXQ1qk9bF/mvce.rs:6:22
  |
6 |     let _ = u16::min as usize; //~ confusing_method_to_numeric_cast
  |                      ^^^^^^^^
  |
help: first cast to a pointer `as *const ()`
  |
6 |     let _ = u16::min as *const () as usize; //~ confusing_method_to_numeric_cast
  |                      ++++++++++++

warning: direct cast of function item into an integer
 --> /tmp/icemaker_global_tempdir.VtLBlWJ2MPJE/rustc_testrunner_tmpdir_reporting.P9jFXQ1qk9bF/mvce.rs:7:22
  |
7 |     let _ = u16::max as usize; //~ confusing_method_to_numeric_cast
  |                      ^^^^^^^^
  |
help: first cast to a pointer `as *const ()`
  |
7 |     let _ = u16::max as *const () as usize; //~ confusing_method_to_numeric_cast
  |                      ++++++++++++

warning: direct cast of function item into an integer
 --> /tmp/icemaker_global_tempdir.VtLBlWJ2MPJE/rustc_testrunner_tmpdir_reporting.P9jFXQ1qk9bF/mvce.rs:8:22
  |
8 |     let _ = u16::min as usize; //~ confusing_method_to_numeric_cast
  |                      ^^^^^^^^
  |
help: first cast to a pointer `as *const ()`
  |
8 |     let _ = u16::min as *const () as usize; //~ confusing_method_to_numeric_cast
  |                      ++++++++++++

warning: direct cast of function item into an integer
  --> /tmp/icemaker_global_tempdir.VtLBlWJ2MPJE/rustc_testrunner_tmpdir_reporting.P9jFXQ1qk9bF/mvce.rs:10:22
   |
10 |     let _ = u16::min as usize; //~ confusing_method_to_numeric_cast
   |                      ^^^^^^^^
   |
help: first cast to a pointer `as *const ()`
   |
10 |     let _ = u16::min as *const () as usize; //~ confusing_method_to_numeric_cast
   |                      ++++++++++++

warning: direct cast of function item into an integer
  --> /tmp/icemaker_global_tempdir.VtLBlWJ2MPJE/rustc_testrunner_tmpdir_reporting.P9jFXQ1qk9bF/mvce.rs:11:22
   |
11 |     let _ = f32::max as usize; //~ confusing_method_to_numeric_cast
   |                      ^^^^^^^^
   |
help: first cast to a pointer `as *const ()`
   |
11 |     let _ = f32::max as *const () as usize; //~ confusing_method_to_numeric_cast
   |                      ++++++++++++

warning: direct cast of function item into an integer
  --> /tmp/icemaker_global_tempdir.VtLBlWJ2MPJE/rustc_testrunner_tmpdir_reporting.P9jFXQ1qk9bF/mvce.rs:12:26
   |
12 |     let _ = f32::minimum as usize; //~ confusing_method_to_numeric_cast
   |                          ^^^^^^^^
   |
help: first cast to a pointer `as *const ()`
   |
12 |     let _ = f32::minimum as *const () as usize; //~ confusing_method_to_numeric_cast
   |                          ++++++++++++

warning: direct cast of function item into an integer
  --> /tmp/icemaker_global_tempdir.VtLBlWJ2MPJE/rustc_testrunner_tmpdir_reporting.P9jFXQ1qk9bF/mvce.rs:13:19
   |
13 |      _ = f32::min as usize; //~ confusing_method_to_numeric_cast
   |                   ^^^^^^^^
   |
help: first cast to a pointer `as *const ()`
   |
13 |      _ = f32::min as *const () as usize; //~ confusing_method_to_numeric_cast
   |                   ++++++++++++

libgccjit.so: error: : builtin "fminimumf" not found
libgccjit.so: error: : gcc_jit_context_new_call: NULL function
gcc_jit_rvalue_get_type: NULL rvalue
gcc_jit_type_get_pointer: NULL type
libgccjit.so: error: : gcc_jit_context_new_bitcast: NULL type
gcc_jit_rvalue_dereference: NULL rvalue
gcc_jit_lvalue_as_rvalue: NULL lvalue
gcc_jit_rvalue_get_type: NULL rvalue
gcc_jit_type_unqualified: NULL type
gcc_jit_type_get_aligned: NULL type
gcc_jit_type_get_pointer: NULL type
libgccjit.so: error: : gcc_jit_context_new_cast: NULL rvalue
gcc_jit_rvalue_dereference: NULL rvalue
libgccjit.so: error: : gcc_jit_block_add_assignment: NULL lvalue
error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "-m64" "/tmp/icemaker_global_tempdir.VtLBlWJ2MPJE/rustc_testrunner_tmpdir_reporting.P9jFXQ1qk9bF/rustcBjOVju/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/icemaker_global_tempdir.VtLBlWJ2MPJE/rustc_testrunner_tmpdir_reporting.P9jFXQ1qk9bF/rustcBjOVju/raw-dylibs" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "outputfile" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: cannot open outputfile.mvce.d7c3bcf1ed0de24f-cgu.0.rcgu.o: No such file or directory
          collect2: error: ld returned 1 exit status
          

error: aborting due to 1 previous error; 8 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