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

rustc_codegen_ssa::mir::locals Unexpected initial operand type #12676

Open
tsatke opened this issue Apr 16, 2024 · 3 comments
Open

rustc_codegen_ssa::mir::locals Unexpected initial operand type #12676

tsatke opened this issue Apr 16, 2024 · 3 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@tsatke
Copy link

tsatke commented Apr 16, 2024

Summary

rustc-ice-2024-04-16T09_01_06-68750.txt

I'm running cargo clippy on https://github.com/tsatke/devos , I'm not sure what causes this.
I'm using MacOS, but I'm also getting the same error with the same stack trace on Ubuntu 22.0.4 (with the latest nightly toolchains).

The first time I got this error was 3 days ago with Clippy version: clippy 0.1.79 (7942405 2024-04-12)

Version

rustc 1.79.0-nightly (ccfcd950b 2024-04-15)
binary: rustc
commit-hash: ccfcd950b333fed046275dd8d54fe736ca498aa7
commit-date: 2024-04-15
host: aarch64-apple-darwin
release: 1.79.0-nightly
LLVM version: 18.1.3

Error output

Backtrace

WARN rustc_codegen_ssa::mir::locals Unexpected initial operand type: expected *mut usize, found !.See <https://github.com/rust-lang/rust/issues/114858>.
thread 'rustc' panicked at /rustc/ccfcd950b333fed046275dd8d54fe736ca498aa7/compiler/rustc_codegen_ssa/src/mir/statement.rs:54:63:
index out of bounds: the len is 2 but the index is 4
stack backtrace:
 0:        0x103e18e84 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7cdb5a1170713007
 1:        0x103e5bf2c - core::fmt::write::h8899ab0faf0aeb5b
 2:        0x103e0f170 - std::io::Write::write_fmt::he01363a5dbf59062
 3:        0x103e18cdc - std::sys_common::backtrace::print::hac59c91626bc9770
 4:        0x103e1b274 - std::panicking::default_hook::{{closure}}::h5367a42dc3a51b34
 5:        0x103e1af64 - std::panicking::default_hook::h325121b0a19ce539
 6:        0x10d4fbc78 - <alloc[bdbe6a1da2a97f8d]::boxed::Box<rustc_driver_impl[1e20964f5d10a404]::install_ice_hook::{closure#0}> as core[a526d0f2da4bdc54]::ops::function::Fn<(&dyn for<'a, 'b> core[a526d0f2da4bdc54]::ops::function::Fn<(&'a core[a526d0f2da4bdc54]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[a526d0f2da4bdc54]::marker::Send + core[a526d0f2da4bdc54]::marker::Sync, &core[a526d0f2da4bdc54]::panic::panic_info::PanicInfo)>>::call
 7:        0x103e1bc84 - std::panicking::rust_panic_with_hook::hb4c26d5b4b34973c
 8:        0x103e1b678 - std::panicking::begin_panic_handler::{{closure}}::h773d17657c6067cf
 9:        0x103e19314 - std::sys_common::backtrace::__rust_end_short_backtrace::h10752405464c3195
10:        0x103e1b3e4 - _rust_begin_unwind
11:        0x103e77cf0 - core::panicking::panic_fmt::ha79b3b561d439946
12:        0x103e77e60 - core::panicking::panic_bounds_check::h745fce92402fce70
13:        0x10d28c6a8 - rustc_codegen_ssa[c9204a01dd46d2f7]::mir::codegen_mir::<rustc_codegen_llvm[5cae397a62af0338]::builder::Builder>
14:        0x10d1ce904 - rustc_codegen_ssa[c9204a01dd46d2f7]::base::codegen_instance::<rustc_codegen_llvm[5cae397a62af0338]::builder::Builder>
15:        0x10d27fcb8 - rustc_codegen_llvm[5cae397a62af0338]::base::compile_codegen_unit::module_codegen
16:        0x10d27f84c - rustc_codegen_llvm[5cae397a62af0338]::base::compile_codegen_unit
17:        0x10d1cdfc8 - rustc_codegen_ssa[c9204a01dd46d2f7]::base::codegen_crate::<rustc_codegen_llvm[5cae397a62af0338]::LlvmCodegenBackend>
18:        0x10d1b94d0 - <rustc_codegen_llvm[5cae397a62af0338]::LlvmCodegenBackend as rustc_codegen_ssa[c9204a01dd46d2f7]::traits::backend::CodegenBackend>::codegen_crate
19:        0x10dce985c - <rustc_session[c9abde6b2634b454]::session::Session>::time::<alloc[bdbe6a1da2a97f8d]::boxed::Box<dyn core[a526d0f2da4bdc54]::any::Any>, rustc_interface[d3728023a92c63c5]::passes::start_codegen::{closure#0}>
20:        0x10dc737c4 - rustc_interface[d3728023a92c63c5]::passes::start_codegen
21:        0x10dcee578 - <rustc_middle[517ab8d5c864a703]::ty::context::GlobalCtxt>::enter::<<rustc_interface[d3728023a92c63c5]::queries::Queries>::codegen_and_build_linker::{closure#0}, core[a526d0f2da4bdc54]::result::Result<rustc_interface[d3728023a92c63c5]::queries::Linker, rustc_span[fb2399e6facb433a]::ErrorGuaranteed>>
22:        0x10dc651c8 - <rustc_interface[d3728023a92c63c5]::queries::Queries>::codegen_and_build_linker
23:        0x10d51ff08 - <rustc_interface[d3728023a92c63c5]::interface::Compiler>::enter::<rustc_driver_impl[1e20964f5d10a404]::run_compiler::{closure#0}::{closure#1}, core[a526d0f2da4bdc54]::result::Result<core[a526d0f2da4bdc54]::option::Option<rustc_interface[d3728023a92c63c5]::queries::Linker>, rustc_span[fb2399e6facb433a]::ErrorGuaranteed>>
24:        0x10d4fe820 - rustc_span[fb2399e6facb433a]::set_source_map::<core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>, rustc_interface[d3728023a92c63c5]::interface::run_compiler<core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>, rustc_driver_impl[1e20964f5d10a404]::run_compiler::{closure#0}>::{closure#0}::{closure#0}>
25:        0x10d53ae18 - <scoped_tls[6317000506047383]::ScopedKey<rustc_span[fb2399e6facb433a]::SessionGlobals>>::set::<rustc_interface[d3728023a92c63c5]::util::run_in_thread_with_globals<rustc_interface[d3728023a92c63c5]::util::run_in_thread_pool_with_globals<rustc_interface[d3728023a92c63c5]::interface::run_compiler<core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>, rustc_driver_impl[1e20964f5d10a404]::run_compiler::{closure#0}>::{closure#0}, core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>>::{closure#0}, core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>>
26:        0x10d50710c - std[882017e1060a487f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d3728023a92c63c5]::util::run_in_thread_with_globals<rustc_interface[d3728023a92c63c5]::util::run_in_thread_pool_with_globals<rustc_interface[d3728023a92c63c5]::interface::run_compiler<core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>, rustc_driver_impl[1e20964f5d10a404]::run_compiler::{closure#0}>::{closure#0}, core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>>::{closure#0}, core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>>
27:        0x10d542a24 - <<std[882017e1060a487f]::thread::Builder>::spawn_unchecked_<rustc_interface[d3728023a92c63c5]::util::run_in_thread_with_globals<rustc_interface[d3728023a92c63c5]::util::run_in_thread_pool_with_globals<rustc_interface[d3728023a92c63c5]::interface::run_compiler<core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>, rustc_driver_impl[1e20964f5d10a404]::run_compiler::{closure#0}>::{closure#0}, core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>>::{closure#0}, core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a526d0f2da4bdc54]::result::Result<(), rustc_span[fb2399e6facb433a]::ErrorGuaranteed>>::{closure#2} as core[a526d0f2da4bdc54]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
28:        0x103e2470c - std::sys::pal::unix::thread::Thread::new::thread_start::h56a548cf4819bf03
29:        0x191ff2f94 - __pthread_joiner_wake

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new?template=ice.yml

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

note: please attach the file at `/Users/tsatke/CLionProjects/devos/rustc-ice-2024-04-16T09_01_06-68750.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C incremental=[REDACTED] -C link-arg=-z -C link-arg=nostart-stop-gc

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
note: Clippy version: clippy 0.1.79 (ccfcd950 2024-04-15)

@tsatke tsatke added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Apr 16, 2024
@tsatke
Copy link
Author

tsatke commented Jun 3, 2024

rust-lang/rust#124375 may be related?

@tsatke
Copy link
Author

tsatke commented Jun 3, 2024

The problem disappears when switching giving the switch function https://github.com/tsatke/devos/blob/23ca7400e3465b344e86e192173a87979f10d142/kernel/src/arch/x86_64/switch.rs a return type of !, however that breaks the functionality.

@tsatke
Copy link
Author

tsatke commented Sep 9, 2024

This issue still persists. I'd be thankful for any pointers or fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

1 participant