rust-lang / rust-lang/rust

[ICE]: slice index out of range in ArArchiveBuilder::build when linking large static archive

Open
#158,211 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-ICE needs-triage T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

(Issue written by GLM5.1)

Code

No minimal repro available — the ICE occurs when compiling the v8 crate (v149.4.0 from crates.io) which links a large static library (librusty_v8.a, ~180 MB). The panic is in the archive building stage, not triggered by any specific source code.

Meta

rustc --version --verbose:

rustc 1.96.0 (ac68faa20 2026-05-25) (Fedora 1.96.0-1.fc44)
binary: rustc
commit-hash: ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96
commit-date: 2026-05-25
host: x86_64-unknown-linux-gnu
release: 1.96.0
LLVM version: 22.1.6
Error output
thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/archive.rs:486:29:
range end index 184748900 out of range for slice of length 182790542

error: the compiler unexpectedly panicked. This is a bug

note: rustc 1.96.0 (ac68faa20 2026-05-25) (Fedora 1.96.0-1.fc44) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C opt-level=1 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on
Backtrace

thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/archive.rs:486:29:
range end index 184748900 out of range for slice of length 182790542
stack backtrace:
   0:     0x7f0cc79654eb - <<std as core::fmt::Display>::fmt
   1:     0x7f0cc70dfdaa - core::fmt::write
   2:     0x7f0cc797f2f6 - <unknown>
   3:     0x7f0cc793372c - <unknown>
   4:     0x7f0cc795561e - std::panicking::default_hook
   5:     0x7f0cc4659502 - <unknown>
   6:     0x7f0cc7955852 - std::panicking::panic_with_hook
   7:     0x7f0cc79337e8 - <unknown>
   8:     0x7f0cc792a779 - <unknown>
   9:     0x7f0cc793525d - __rustc::rust_begin_unwind
  10:     0x7f0cc3e4a13c - core::panicking::panic_fmt
  11:     0x7f0cc3e4a228 - core::slice::index::slice_index_fail
  12:     0x7f0cc72b6917 - <unknown>
  13:     0x7f0cc72eb29c - <ArArchiveBuilder as ArchiveBuilder>::build
  14:     0x7f0cc72c2814 - rustc_codegen_ssa::back::link::link_binary
  15:     0x7f0cc729eb62 - <LlvmCodegenBackend as CodegenBackend>::link
  16:     0x7f0cc74b3162 - <rustc_interface::queries::Linker>::link
  17:     0x7f0cc736fd98 - <unknown>
  18:     0x7f0cc736c82b - <unknown>
  19:     0x7f0cc7372362 - <unknown>
  20:     0x7f0cc7962345 - <unknown>
  21:     0x7f0cc3c79d19 - start_thread
  22:     0x7f0cc3cfd64c - __clone3
  23:                0x0 - <unknown>

query stack during panic:
end of query stack

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 compiler/rustc_codegen_ssa/src/back/archive.rs at line 486 and inspect ArArchiveBuilder::build, using the v8 crate's large librusty_v8.a archive to reproduce the panic. Trace why the requested slice range exceeds the archive length; done means compiling that large static archive without the compiler panic.

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
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.