rust-lang / rust-lang/rustc_codegen_gcc

ICE `inlining failed in call to ‘always_inline’ function body not available` (`-Copt-level=(2..)`

Open
#832 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
1.2k
Forks
105
Avg merge
8h 20m
Merged PRs (30d)
14

Description

snippet:

//@compile-flags: -Zcodegen-backend=gcc -Clink-dead-code=true -Copt-level=3
fn main() {
    let mut bytes = vec![];
    let id = 1234u32;
    let port_number = 8080u16;
    let some_random_string = "".to_string();
    bytes.splice(0..4, id.to_be_bytes());
    bytes.splice(25..27, port_number.to_be_bytes());
    some_random_string.as_bytes().to_vec();
    println!("bytes: {:?}, len: {}", bytes, bytes.len())
}

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 -Copt-level=3

Program output

libgccjit.so: error: : inlining failed in call to ‘always_inline’ ‘_RNvXs2D_NtNtCsjXZVF46obq5_4core5slice4iterINtB6_4IterhENtNtNtNtBa_4iter6traits10exact_size17ExactSizeIterator3lenCs3Ktur3hQz7J_4mvce’: function body not available
libgccjit.so: error: : inlining failed in call to ‘always_inline’ ‘_RNvMs2C_NtNtCsjXZVF46obq5_4core5slice4iterINtB6_4IterhE10make_sliceCs3Ktur3hQz7J_4mvce’: function body not available
libgccjit.so: error: : inlining failed in call to ‘always_inline’ ‘_RNvXs2D_NtNtCsjXZVF46obq5_4core5slice4iterINtB6_4IterhENtNtNtNtBa_4iter6traits10exact_size17ExactSizeIterator3lenCs3Ktur3hQz7J_4mvce’: function body not available
libgccjit.so: error: : inlining failed in call to ‘always_inline’ ‘_RNvMs2C_NtNtCsjXZVF46obq5_4core5slice4iterINtB6_4IterhE10make_sliceCs3Ktur3hQz7J_4mvce’: function body not available
error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "-m64" "/tmp/icemaker_global_tempdir.O3K6xjHgMH4d/rustc_testrunner_tmpdir_reporting.RIyO3bTgJ9ub/rustcFOFs9D/symbols.o" "<3 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.O3K6xjHgMH4d/rustc_testrunner_tmpdir_reporting.RIyO3bTgJ9ub/rustcFOFs9D/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" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: cannot open outputfile.mvce.2bac8b0cd4d5b33d-cgu.1.rcgu.o: No such file or directory
          collect2: error: ld returned 1 exit status
          

error: aborting due to 1 previous error


Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Rust reproducer in /tmp/gcc/a.rs and run it using -Zcodegen-backend=gcc, -Clink-dead-code=true, and -Copt-level=3. Trace the generated object files and libgccjit linker errors to identify why the always_inline function body is unavailable; done means the reproducer links successfully without the ICE.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.