Skip to content

ICE on aarch64-unknown-linux-gnu #6

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

Open
icmccorm opened this issue Mar 27, 2025 · 1 comment
Open

ICE on aarch64-unknown-linux-gnu #6

icmccorm opened this issue Mar 27, 2025 · 1 comment

Comments

@icmccorm
Copy link
Contributor

icmccorm commented Mar 27, 2025

We've encountered a target-specific ICE on aarch64-unknown-linux-gnu.

The error occurs when lowering a StorageLive statement in rustc_codegen_ssa.

mir::StatementKind::StorageLive(local) => {
    if let LocalRef::Place(cg_place) = self.locals[local] {
    ...

If -Zmir-opt-level is set to 0, then this leads to an access out of bounds

index out of bounds: the len is 2 but the index is 4

This occurs when cargo-bsan builds a sysroot—we need to disable optimizations to ensure completeness.

This could be related to #114858, since a similar error message occurred prior to this ICE.

Since we're still on 1.84.0, it may be worth rebasing to see if this has been fixed upstream. We need to, anyway, so that we're up to edition 2024.

Backtrace
thread 'rustc' panicked at /workspaces/bsan-clean/compiler/rustc_codegen_ssa/src/mir/statement.rs:55:63:
index out of bounds: the len is 2 but the index is 4
stack backtrace:
   0:     0xffffb4604350 - std::backtrace::Backtrace::create::h85f56b67aa7c158e
   1:     0xffffb16bb384 - <alloc[7edc18442b665ee0]::boxed::Box<rustc_driver_impl[381831b3c637c6cb]::install_ice_hook::{closure#0}> as core[935e1d575dcbd14f]::ops::function::Fn<(&dyn for<'a, 'b> core[935e1d575dcbd14f]::ops::function::Fn<(&'a std[5192b883daf2d25a]::panic::PanicHookInfo<'b>,), Output = ()> + core[935e1d575dcbd14f]::marker::Send + core[935e1d575dcbd14f]::marker::Sync, &std[5192b883daf2d25a]::panic::PanicHookInfo)>>::call
   2:     0xffffb4605ecc - std::panicking::rust_panic_with_hook::h314f43ffdaa0a787
   3:     0xffffb462b2b8 - std::panicking::begin_panic_handler::{{closure}}::h701468939c3fe3e7
   4:     0xffffb462b104 - std::sys::backtrace::__rust_end_short_backtrace::hde36ba2f3df3203e
   5:     0xffffb4605a40 - rust_begin_unwind
   6:     0xffffb164661c - core::panicking::panic_fmt::h0285c8d72aea4d47
   7:     0xffffb164679c - core::panicking::panic_bounds_check::h9b1deace62d72489
   8:     0xffffb1a94968 - rustc_codegen_ssa[d224b4682297e97a]::mir::codegen_mir::<rustc_codegen_llvm[d4e502d558f4aa61]::builder::Builder>
   9:     0xffffb1ac666c - rustc_codegen_ssa[d224b4682297e97a]::base::codegen_instance::<rustc_codegen_llvm[d4e502d558f4aa61]::builder::Builder>
  10:     0xffffb1a6a200 - <rustc_middle[850c4a305539696d]::mir::mono::MonoItem as rustc_codegen_ssa[d224b4682297e97a]::mono_item::MonoItemExt>::define::<rustc_codegen_llvm[d4e502d558f4aa61]::builder::Builder>
  11:     0xffffb1a0b404 - rustc_codegen_llvm[d4e502d558f4aa61]::base::compile_codegen_unit::module_codegen
  12:     0xffffb1a0a328 - rustc_codegen_llvm[d4e502d558f4aa61]::base::compile_codegen_unit
  13:     0xffffb1ac5f70 - rustc_codegen_ssa[d224b4682297e97a]::base::codegen_crate::<rustc_codegen_llvm[d4e502d558f4aa61]::LlvmCodegenBackend>
  14:     0xffffb19d0440 - <rustc_codegen_llvm[d4e502d558f4aa61]::LlvmCodegenBackend as rustc_codegen_ssa[d224b4682297e97a]::traits::backend::CodegenBackend>::codegen_crate
  15:     0xffffb1964704 - <rustc_session[bacdbeb9eaac6008]::session::Session>::time::<alloc[7edc18442b665ee0]::boxed::Box<dyn core[935e1d575dcbd14f]::any::Any>, rustc_interface[651beeed26057850]::passes::start_codegen::{closure#0}>
  16:     0xffffb18cf1a0 - rustc_interface[651beeed26057850]::passes::start_codegen
  17:     0xffffb191cd10 - <rustc_interface[651beeed26057850]::queries::Linker>::codegen_and_build_linker
  18:     0xffffb1676de0 - <rustc_middle[850c4a305539696d]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[381831b3c637c6cb]::run_compiler::{closure#0}::{closure#1}::{closure#7}, core[935e1d575dcbd14f]::result::Result<core[935e1d575dcbd14f]::option::Option<rustc_interface[651beeed26057850]::queries::Linker>, rustc_span[39232fce6df641d9]::ErrorGuaranteed>>
  19:     0xffffb165cbcc - <rustc_interface[651beeed26057850]::interface::Compiler>::enter::<rustc_driver_impl[381831b3c637c6cb]::run_compiler::{closure#0}::{closure#1}, core[935e1d575dcbd14f]::result::Result<core[935e1d575dcbd14f]::option::Option<rustc_interface[651beeed26057850]::queries::Linker>, rustc_span[39232fce6df641d9]::ErrorGuaranteed>>
  20:     0xffffb16ad040 - rustc_span[39232fce6df641d9]::create_session_globals_then::<core[935e1d575dcbd14f]::result::Result<(), rustc_span[39232fce6df641d9]::ErrorGuaranteed>, rustc_interface[651beeed26057850]::util::run_in_thread_with_globals<rustc_interface[651beeed26057850]::util::run_in_thread_pool_with_globals<rustc_interface[651beeed26057850]::interface::run_compiler<core[935e1d575dcbd14f]::result::Result<(), rustc_span[39232fce6df641d9]::ErrorGuaranteed>, rustc_driver_impl[381831b3c637c6cb]::run_compiler::{closure#0}>::{closure#1}, core[935e1d575dcbd14f]::result::Result<(), rustc_span[39232fce6df641d9]::ErrorGuaranteed>>::{closure#0}, core[935e1d575dcbd14f]::result::Result<(), rustc_span[39232fce6df641d9]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
  21:     0xffffb16a1ebc - std[5192b883daf2d25a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[651beeed26057850]::util::run_in_thread_with_globals<rustc_interface[651beeed26057850]::util::run_in_thread_pool_with_globals<rustc_interface[651beeed26057850]::interface::run_compiler<core[935e1d575dcbd14f]::result::Result<(), rustc_span[39232fce6df641d9]::ErrorGuaranteed>, rustc_driver_impl[381831b3c637c6cb]::run_compiler::{closure#0}>::{closure#1}, core[935e1d575dcbd14f]::result::Result<(), rustc_span[39232fce6df641d9]::ErrorGuaranteed>>::{closure#0}, core[935e1d575dcbd14f]::result::Result<(), rustc_span[39232fce6df641d9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[935e1d575dcbd14f]::result::Result<(), rustc_span[39232fce6df641d9]::ErrorGuaranteed>>
  22:     0xffffb16a4c98 - <<std[5192b883daf2d25a]::thread::Builder>::spawn_unchecked_<rustc_interface[651beeed26057850]::util::run_in_thread_with_globals<rustc_interface[651beeed26057850]::util::run_in_thread_pool_with_globals<rustc_interface[651beeed26057850]::interface::run_compiler<core[935e1d575dcbd14f]::result::Result<(), rustc_span[39232fce6df641d9]::ErrorGuaranteed>, rustc_driver_impl[381831b3c637c6cb]::run_compiler::{closure#0}>::{closure#1}, core[935e1d575dcbd14f]::result::Result<(), rustc_span[39232fce6df641d9]::ErrorGuaranteed>>::{closure#0}, core[935e1d575dcbd14f]::result::Result<(), rustc_span[39232fce6df641d9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[935e1d575dcbd14f]::result::Result<(), rustc_span[39232fce6df641d9]::ErrorGuaranteed>>::{closure#1} as core[935e1d575dcbd14f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  23:     0xffffb45f0288 - std::sys::pal::unix::thread::Thread::new::thread_start::h7de62ad4f651f1b7
  24:     0xffffb0ccd5b8 - <unknown>
  25:     0xffffb0d35edc - <unknown>
  26:                0x0 - <unknown>


rustc version: 1.84.0-dev (BorrowSanitizer)
platform: aarch64-unknown-linux-gnu

query stack during panic:
end of query stack
@icmccorm
Copy link
Contributor Author

I've confirmed that this is bug was not directly caused by our changes to cargo-miri. I incrementally pared down an unmodified copy of src/tools/miri within an aarch64 Linux container, compiling it regularly until I replicated the erro. Everything continued to work as expected until I disabled Miri's "hack" for switching to check-only builds (removing link in --emit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant