Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: src/isa/x64/abi.rs:743:68: 'called Result::unwrap() on an Err value: TryFromIntError(()) #1552

Open
matthiaskrgr opened this issue Jan 5, 2025 · 1 comment
Labels
C-bug Category: This is a bug. upstream Caused by a dependency

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

//@compile-flags: -Zcodegen-backend=cranelift --crate-type=lib
//

pub const fn foo() {
    let mut array = [[0; 0x12345679]; 1];
}

original:

//@ check-pass
// Regression test for issue #79152
//
// Tests that we can index an array in a const function

pub const fn foo() {
    let mut array = [[0; 0x12345679]; 1];
    array[0][3490] = 1;
}

Version information

rustc 1.86.0-nightly (1891c2866 2025-01-04)
binary: rustc
commit-hash: 1891c28669863bf7ed3ef8f43f2d3fa546f34861
commit-date: 2025-01-04
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.6

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

Program output

warning: unused variable: `array`
 --> /tmp/icemaker_global_tempdir.eFjNhF4XNbW5/rustc_testrunner_tmpdir_reporting.b1NV3CWuBxKo/mvce.rs:4:13
  |
4 |     let mut array = [[0; 0x12345679]; 1];
  |             ^^^^^ help: if this is intentional, prefix it with an underscore: `_array`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: variable does not need to be mutable
 --> /tmp/icemaker_global_tempdir.eFjNhF4XNbW5/rustc_testrunner_tmpdir_reporting.b1NV3CWuBxKo/mvce.rs:4:9
  |
4 |     let mut array = [[0; 0x12345679]; 1];
  |         ----^^^^^
  |         |
  |         help: remove this `mut`
  |
  = note: `#[warn(unused_mut)]` on by default


thread '<unnamed>' panicked at /rust/deps/cranelift-codegen-0.114.0/src/isa/x64/abi.rs:743:68:
called `Result::unwrap()` on an `Err` value: TryFromIntError(())
stack backtrace:
   0:     0x7a23fe0d34ba - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hc56bb2061e3f2faf
   1:     0x7a23fe8135e6 - core::fmt::write::hf476acdbab1f8242
   2:     0x7a23ff71a311 - std::io::Write::write_fmt::hff3ae507590478c7
   3:     0x7a23fe0d3312 - std::sys::backtrace::BacktraceLock::print::h59430f67692bb429
   4:     0x7a23fe0d58b7 - std::panicking::default_hook::{{closure}}::h85fc82fd35f7c854
   5:     0x7a23fe0d56a0 - std::panicking::default_hook::h149038da7be0a2dc
   6:     0x7a23fd250738 - std[3aac40dc3bd55acb]::panicking::update_hook::<alloc[11ef5de1b489fae0]::boxed::Box<rustc_driver_impl[550e196038d14fc8]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7a23fe0d6103 - std::panicking::rust_panic_with_hook::h91fff69bbdba9796
   8:     0x7a23fe0d5dfa - std::panicking::begin_panic_handler::{{closure}}::hd4b1f7b56f925873
   9:     0x7a23fe0d3989 - std::sys::backtrace::__rust_end_short_backtrace::hd7883fbf49e31f3d
  10:     0x7a23fe0d5abd - rust_begin_unwind
  11:     0x7a23fad9e730 - core::panicking::panic_fmt::h67ab54dd60b05f99
  12:     0x7a23fb1fd5f6 - core::result::unwrap_failed::h353552c90ac0676e
  13:     0x7a23ef81c93b - <cranelift_codegen[bd234fa8b941f2]::isa::x64::abi::X64ABIMachineSpec as cranelift_codegen[bd234fa8b941f2]::machinst::abi::ABIMachineSpec>::gen_clobber_save
  14:     0x7a23ef7a497b - <cranelift_codegen[bd234fa8b941f2]::machinst::vcode::VCode<cranelift_codegen[bd234fa8b941f2]::isa::x64::lower::isle::generated_code::MInst>>::emit
  15:     0x7a23ef849a1b - <cranelift_codegen[bd234fa8b941f2]::isa::x64::X64Backend as cranelift_codegen[bd234fa8b941f2]::isa::TargetIsa>::compile_function
  16:     0x7a23ef8cc705 - <cranelift_codegen[bd234fa8b941f2]::context::Context>::compile_stencil
  17:     0x7a23ef8cd040 - <cranelift_codegen[bd234fa8b941f2]::context::Context>::compile
  18:     0x7a23ef695e31 - <cranelift_object[c43bbcd72abb143b]::backend::ObjectModule as cranelift_module[512baebcd4621a44]::module::Module>::define_function_with_control_plane
  19:     0x7a23ef65872e - rustc_codegen_cranelift[bb5c3dc512b2c6bb]::driver::aot::module_codegen::{closure#0}
  20:     0x7a23ef5ebb99 - std[3aac40dc3bd55acb]::sys::backtrace::__rust_begin_short_backtrace::<rustc_codegen_cranelift[bb5c3dc512b2c6bb]::driver::aot::module_codegen::{closure#0}, core[b46bc0d640c29f3e]::result::Result<rustc_codegen_cranelift[bb5c3dc512b2c6bb]::driver::aot::ModuleCodegenResult, alloc[11ef5de1b489fae0]::string::String>>
  21:     0x7a23ef5f5633 - <<std[3aac40dc3bd55acb]::thread::Builder>::spawn_unchecked_<rustc_codegen_cranelift[bb5c3dc512b2c6bb]::driver::aot::module_codegen::{closure#0}, core[b46bc0d640c29f3e]::result::Result<rustc_codegen_cranelift[bb5c3dc512b2c6bb]::driver::aot::ModuleCodegenResult, alloc[11ef5de1b489fae0]::string::String>>::{closure#1} as core[b46bc0d640c29f3e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  22:     0x7a23ff615aef - std::sys::pal::unix::thread::Thread::new::thread_start::h9fd3085ff298f095
  23:     0x7a23f9aa339d - <unknown>
  24:     0x7a23f9b2849c - <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.86.0-nightly (1891c2866 2025-01-04) running on x86_64-unknown-linux-gnu

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

query stack during panic:
end of query stack
warning: 2 warnings emitted


@bjorn3
Copy link
Member

bjorn3 commented Jan 5, 2025

Probably similar root cause to #1434 (not early rejecting stack slots that are too large)

@bjorn3 bjorn3 added C-bug Category: This is a bug. upstream Caused by a dependency labels Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. upstream Caused by a dependency
Projects
None yet
Development

No branches or pull requests

2 participants