Skip to content

ICE: assertion failed: value <= 0xFFFF_FF00 #121126

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

fn main() {
    let _n = 1i64 >> [64][4_294_967_295];
}

original:

// build-fail
// compile-flags: -C debug-assertions

#![deny(arithmetic_overflow)]

fn main() {
    let _n = 1i64 >> [64][4_294_967_295];
    //~^ ERROR: this arithmetic operation will overflow
}

Version information

rustc 1.78.0-nightly (ee9c7c940 2024-02-14)
binary: rustc
commit-hash: ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46
commit-date: 2024-02-14
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error: this operation will panic at runtime
 --> /tmp/icemaker_global_tempdir.rNcBg9EDTBPd/rustc_testrunner_tmpdir_reporting.ckrlm3bA7Huu/mvce.rs:2:22
  |
2 |     let _n = 1i64 >> [64][4_294_967_295];
  |                      ^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4294967295
  |
  = note: `#[deny(unconditional_panic)]` on by default

thread 'rustc' panicked at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/compiler/rustc_target/src/abi/mod.rs:22:1:
assertion failed: value <= 0xFFFF_FF00
stack backtrace:
   0:     0x7f953378ce46 - std::backtrace_rs::backtrace::libunwind::trace::h5168cb64cb843b87
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f953378ce46 - std::backtrace_rs::backtrace::trace_unsynchronized::hbbff473666b784c6
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f953378ce46 - std::sys_common::backtrace::_print_fmt::h6c61b632e6cc7949
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f953378ce46 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h974a6b559c2b8d41
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f95337dd46c - core::fmt::rt::Argument::fmt::hf6a5273aff56768c
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/core/src/fmt/rt.rs:142:9
   5:     0x7f95337dd46c - core::fmt::write::h1caffe3a78971207
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f95337807ef - std::io::Write::write_fmt::h2caf2bb3485e27a5
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/io/mod.rs:1854:15
   7:     0x7f953378cbf4 - std::sys_common::backtrace::_print::h0414d95b24b9ea44
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f953378cbf4 - std::sys_common::backtrace::print::hfdf60e3b3d06625d
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f953378f93b - std::panicking::default_hook::{{closure}}::h3c1109072cde0ade
  10:     0x7f953378f689 - std::panicking::default_hook::hfe3c076d4f24ecbe
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/panicking.rs:292:9
  11:     0x7f95365f563c - std[2308076c1424b998]::panicking::update_hook::<alloc[33ce0ef41c101337]::boxed::Box<rustc_driver_impl[d317596fd5f90102]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f95337900a0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h8a55f98e23703736
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/alloc/src/boxed.rs:2030:9
  13:     0x7f95337900a0 - std::panicking::rust_panic_with_hook::hc147efcd5d482f2c
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/panicking.rs:785:13
  14:     0x7f953378fda9 - std::panicking::begin_panic_handler::{{closure}}::h6174f0cd2a065d90
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/panicking.rs:651:13
  15:     0x7f953378d326 - std::sys_common::backtrace::__rust_end_short_backtrace::h770b1c8f4d2029d4
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f953378fb14 - rust_begin_unwind
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/panicking.rs:647:5
  17:     0x7f95337d9975 - core::panicking::panic_fmt::h66e8ea0facb42563
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/core/src/panicking.rs:72:14
  18:     0x7f95337d9a33 - core::panicking::panic::h272a74656aca8902
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/core/src/panicking.rs:144:5
  19:     0x7f9538bcde42 - <rustc_mir_transform[c0673d0b3c528a53]::const_prop_lint::ConstPropagator>::get_const.cold.0
  20:     0x7f9535136654 - <rustc_mir_transform[c0673d0b3c528a53]::const_prop_lint::ConstPropagator as rustc_middle[efc8e2d5742a68dd]::mir::visit::Visitor>::visit_assign
  21:     0x7f9537e28c5b - <rustc_mir_transform[c0673d0b3c528a53]::const_prop_lint::ConstPropagator as rustc_middle[efc8e2d5742a68dd]::mir::visit::Visitor>::visit_body
  22:     0x7f95351325d6 - <rustc_mir_transform[c0673d0b3c528a53]::const_prop_lint::ConstPropLint as rustc_mir_transform[c0673d0b3c528a53]::pass_manager::MirLint>::run_lint
  23:     0x7f953781420f - rustc_mir_transform[c0673d0b3c528a53]::pass_manager::run_passes_inner
  24:     0x7f9537fb3684 - rustc_mir_transform[c0673d0b3c528a53]::mir_drops_elaborated_and_const_checked
  25:     0x7f9537fb2fa9 - rustc_query_impl[ecef4a4fa1cc3689]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ecef4a4fa1cc3689]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[efc8e2d5742a68dd]::query::erase::Erased<[u8; 8usize]>>
  26:     0x7f953798cdb0 - rustc_query_system[8b26caae5283da17]::query::plumbing::try_execute_query::<rustc_query_impl[ecef4a4fa1cc3689]::DynamicConfig<rustc_query_system[8b26caae5283da17]::query::caches::VecCache<rustc_span[e043cedf16fd8748]::def_id::LocalDefId, rustc_middle[efc8e2d5742a68dd]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ecef4a4fa1cc3689]::plumbing::QueryCtxt, false>
  27:     0x7f953798c69c - rustc_query_impl[ecef4a4fa1cc3689]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f95381fbb3f - rustc_interface[e88069c12facd435]::passes::analysis
  29:     0x7f95381fb229 - rustc_query_impl[ecef4a4fa1cc3689]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ecef4a4fa1cc3689]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[efc8e2d5742a68dd]::query::erase::Erased<[u8; 1usize]>>
  30:     0x7f953863afe5 - rustc_query_system[8b26caae5283da17]::query::plumbing::try_execute_query::<rustc_query_impl[ecef4a4fa1cc3689]::DynamicConfig<rustc_query_system[8b26caae5283da17]::query::caches::SingleCache<rustc_middle[efc8e2d5742a68dd]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ecef4a4fa1cc3689]::plumbing::QueryCtxt, false>
  31:     0x7f953863ad49 - rustc_query_impl[ecef4a4fa1cc3689]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f9538644695 - rustc_interface[e88069c12facd435]::interface::run_compiler::<core[db7e23408f407db6]::result::Result<(), rustc_span[e043cedf16fd8748]::ErrorGuaranteed>, rustc_driver_impl[d317596fd5f90102]::run_compiler::{closure#0}>::{closure#0}
  33:     0x7f95387c5ad8 - std[2308076c1424b998]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e88069c12facd435]::util::run_in_thread_with_globals<rustc_interface[e88069c12facd435]::util::run_in_thread_pool_with_globals<rustc_interface[e88069c12facd435]::interface::run_compiler<core[db7e23408f407db6]::result::Result<(), rustc_span[e043cedf16fd8748]::ErrorGuaranteed>, rustc_driver_impl[d317596fd5f90102]::run_compiler::{closure#0}>::{closure#0}, core[db7e23408f407db6]::result::Result<(), rustc_span[e043cedf16fd8748]::ErrorGuaranteed>>::{closure#0}, core[db7e23408f407db6]::result::Result<(), rustc_span[e043cedf16fd8748]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[db7e23408f407db6]::result::Result<(), rustc_span[e043cedf16fd8748]::ErrorGuaranteed>>
  34:     0x7f95387c5904 - <<std[2308076c1424b998]::thread::Builder>::spawn_unchecked_<rustc_interface[e88069c12facd435]::util::run_in_thread_with_globals<rustc_interface[e88069c12facd435]::util::run_in_thread_pool_with_globals<rustc_interface[e88069c12facd435]::interface::run_compiler<core[db7e23408f407db6]::result::Result<(), rustc_span[e043cedf16fd8748]::ErrorGuaranteed>, rustc_driver_impl[d317596fd5f90102]::run_compiler::{closure#0}>::{closure#0}, core[db7e23408f407db6]::result::Result<(), rustc_span[e043cedf16fd8748]::ErrorGuaranteed>>::{closure#0}, core[db7e23408f407db6]::result::Result<(), rustc_span[e043cedf16fd8748]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[db7e23408f407db6]::result::Result<(), rustc_span[e043cedf16fd8748]::ErrorGuaranteed>>::{closure#1} as core[db7e23408f407db6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35:     0x7f95337991e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hbe12538a3d7e111d
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/alloc/src/boxed.rs:2016:9
  36:     0x7f95337991e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h306728bac30291a0
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/alloc/src/boxed.rs:2016:9
  37:     0x7f95337991e5 - std::sys::pal::unix::thread::Thread::new::thread_start::hec142a176366d167
                               at /rustc/ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46/library/std/src/sys/pal/unix/thread.rs:108:17
  38:     0x7f95335809eb - <unknown>
  39:     0x7f95336047cc - <unknown>
  40:                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: rustc 1.78.0-nightly (ee9c7c940 2024-02-14) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error


Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityS-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions