rust-lang / rust-lang/rustc_codegen_cranelift

ICE `guard_size * probe_count` is too large to fit in a 32-bit immediate

Open
#1,656 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.1k
Forks
157
Avg merge
1d 19h
Merged PRs (30d)
3

Description

might be similar to https://github.com/rust-lang/rustc_codegen_cranelift/issues/1552

snippet:

//@compile-flags: -Zcodegen-backend=cranelift
fn main() {
    assert_eq!(&mut [0; 536870787_usize][..], &mut []);
}

Version information

rustc 1.98.0-nightly (8c1d72083 2026-05-28)
binary: rustc
commit-hash: 8c1d72083bb2b7b9df8cbbf06a57d240a007bd85
commit-date: 2026-05-28
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcodegen-backend=cranelift

Program output


thread '<unnamed>' (3650454) panicked at /rust/deps/cranelift-codegen-0.131.0/src/isa/x64/inst/emit.rs:373:18:
`guard_size * probe_count` is too large to fit in a 32-bit immediate: TryFromIntError(PosOverflow)
stack backtrace:
   0:     0x7fa36dcb8189 - <<std[d49b81100c593501]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[307308a59b42f609]::fmt::Display>::fmt
   1:     0x7fa36e420988 - core[307308a59b42f609]::fmt::write
   2:     0x7fa36dccee76 - <std[d49b81100c593501]::sys::stdio::unix::Stderr as std[d49b81100c593501]::io::Write>::write_fmt
   3:     0x7fa36dc8e3ae - std[d49b81100c593501]::panicking::default_hook::{closure#0}
   4:     0x7fa36dcabac3 - std[d49b81100c593501]::panicking::default_hook
   5:     0x7fa36caa7ff1 - std[d49b81100c593501]::panicking::update_hook::<alloc[41b0df45fb608239]::boxed::Box<rustc_driver_impl[98011a5ec9f8d80f]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fa36dcabda2 - std[d49b81100c593501]::panicking::panic_with_hook
   7:     0x7fa36dc8e472 - std[d49b81100c593501]::panicking::panic_handler::{closure#0}
   8:     0x7fa36dc85179 - std[d49b81100c593501]::sys::backtrace::__rust_end_short_backtrace::<std[d49b81100c593501]::panicking::panic_handler::{closure#0}, !>
   9:     0x7fa36dc8fedd - __rustc[2f0bfc8ff0e38b1b]::rust_begin_unwind
  10:     0x7fa36a8c600c - core[307308a59b42f609]::panicking::panic_fmt
  11:     0x7fa36a146432 - core[307308a59b42f609]::result::unwrap_failed
  12:     0x7fa35b8f858c - cranelift_codegen[39a7ea38a4c937d3]::isa::x64::inst::emit::emit
  13:     0x7fa35b7c85fc - <cranelift_codegen[39a7ea38a4c937d3]::machinst::vcode::VCode<cranelift_codegen[39a7ea38a4c937d3]::isa::x64::lower::isle::generated_code::MInst>>::emit::{closure#0}
  14:     0x7fa35b844dea - <cranelift_codegen[39a7ea38a4c937d3]::machinst::vcode::VCode<cranelift_codegen[39a7ea38a4c937d3]::isa::x64::lower::isle::generated_code::MInst>>::emit
  15:     0x7fa35b9fcd84 - <cranelift_codegen[39a7ea38a4c937d3]::isa::x64::X64Backend as cranelift_codegen[39a7ea38a4c937d3]::isa::TargetIsa>::compile_function
  16:     0x7fa35b7cfb82 - <cranelift_codegen[39a7ea38a4c937d3]::context::Context>::compile_stencil
  17:     0x7fa35b7d2ebc - <cranelift_codegen[39a7ea38a4c937d3]::context::Context>::compile
  18:     0x7fa35b50acbd - <cranelift_object[887794265853d69c]::backend::ObjectModule as cranelift_module[910bb730e5e13cb2]::module::Module>::define_function_with_control_plane
  19:     0x7fa35b4814d7 - rustc_codegen_cranelift[67e25b9fd755daac]::driver::aot::module_codegen::{closure#0}
  20:     0x7fa35b470869 - https://github.com/rust-lang/rustc_codegen_cranelift/issues/1552std[d49b81100c593501]::sys::backtrace::__rust_begin_short_backtrace::<rustc_codegen_cranelift[67e25b9fd755daac]::driver::aot::module_codegen::{closure#0}, core[307308a59b42f609]::result::Result<rustc_codegen_cranelift[67e25b9fd755daac]::driver::aot::ModuleCodegenResult, alloc[41b0df45fb608239]::string::String>>
  21:     0x7fa35b4869ea - <std[d49b81100c593501]::thread::lifecycle::spawn_unchecked<rustc_codegen_cranelift[67e25b9fd755daac]::driver::aot::module_codegen::{closure#0}, core[307308a59b42f609]::result::Result<rustc_codegen_cranelift[67e25b9fd755daac]::driver::aot::ModuleCodegenResult, alloc[41b0df45fb608239]::string::String>>::{closure#1} as core[307308a59b42f609]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  22:     0x7fa36f5b5a2c - <std[d49b81100c593501]::sys::thread::unix::Thread>::new::thread_start
  23:     0x7fa368a981b9 - <unknown>
  24:     0x7fa368b1d21c - <unknown>
  25:                0x0 - <unknown>

error: the compiler unexpectedly panicked. This is a bug

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.98.0-nightly (8c1d72083 2026-05-28) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z codegen-backend=cranelift -Z dump-mir-dir=dir

query stack during panic:
end of query stack

Contributor guide

No contributing guide indexed for this repository

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 by reproducing the ICE with the issue's main.rs snippet and -Zcodegen-backend=cranelift, then inspect Cranelift's x64 emitter at cranelift-codegen/src/isa/x64/inst/emit.rs:373. Done means the case no longer panics and a regression test covers the oversized guard_size * probe_count value.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.