Open jasondyoungberg opened 1 month ago
I've also tested some different versions, it looks like the error was introduced in nightly-2024-04-13
.
nightly-2024-05-25
: crash
nightly-2024-05-24
: crash
nightly-2024-05-10
: crash
nightly-2024-05-01
: crash
nightly-2024-04-20
: crash
nightly-2024-04-16
: crash
nightly-2024-04-13
: crash
nightly-2024-04-12
: success
nightly-2024-04-11
: success
I don't think this is a clippy issue but rather a rustc issue, @blyxyas @y21 what do you think?
Does this also happen with cargo check
? That would give us a good lead :heart:
Does this also happen with
cargo check
? That would give us a good lead ❤️
No, just clippy
FWIW, this looks very similar to #12676, as well as the upstream issue rust-lang/rust#124375. With RUSTC_LOG=debug
it looks like the crash happens while codegen'ing breakpoint_handler
, which does look suspiciously similar to the code in the rustc issue, so might be related. The bisection above also matches with the date when those two issues were filed.
Seems very strange that this only happens in clippy. I also have no idea why clippy would want to touch the codegen backend like the backtrace suggests with the llvm frames. I sadly don't have time to properly investigate atm though..
Iirc in the flame graph @blyxyas shared on zulip in the bolt optimisations topic (https://rust-lang.zulipchat.com/user_uploads/4715/KEypA_Br149UjxNwduPDnfMN/image.png), some codegen is invoked before clippy executes, but the fact that cargo check — which is supposed to run the same initial steps — doesn't ICE is weird.
I will try to look more into this.
Summary
Running
cargo clippy
on https://github.com/jasondyoungberg/my-os/tree/b1875e12124b634e9cb90b9d5cce4bb8b327826d causes an errorrustc-ice-2024-05-25T15_13_29-5792.txt
Version
Error output
Backtrace
``` cargo : Compiling bootloader v0.11.7 At line:1 char:1 + cargo clippy 2> log.txt + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: ( Compiling bootloader v0.11.7:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError Compiling kernel v0.1.0 (C:\Users\jason\code\my-os\kernel) WARN rustc_codegen_ssa::mir::locals Unexpected initial operand type: expected x86_64::structures::idt::InterruptStackFrame, found !.See.
thread 'rustc' panicked at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e\compiler\rustc_codegen_ssa\src\mir\statement.rs:55:63:
index out of bounds: the len is 3 but the index is 3
stack backtrace:
0: 0x7fff0ed33aed - std::backtrace_rs::backtrace::dbghelp64::trace
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
1: 0x7fff0ed33aed - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
2: 0x7fff0ed33aed - std::sys_common::backtrace::_print_fmt
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\sys_common\backtrace.rs:68
3: 0x7fff0ed33aed - std::sys_common::backtrace::_print::impl$0::fmt
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\sys_common\backtrace.rs:44
4: 0x7fff0ed64a69 - core::fmt::rt::Argument::fmt
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\core\src\fmt\rt.rs:165
5: 0x7fff0ed64a69 - core::fmt::write
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\core\src\fmt\mod.rs:1172
6: 0x7fff0ed2a3c1 - std::io::Write::write_fmt
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\io\mod.rs:1835
7: 0x7fff0ed338c6 - std::sys_common::backtrace::print
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\sys_common\backtrace.rs:34
8: 0x7fff0ed36a98 - std::panicking::default_hook::closure$1
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\panicking.rs:271
9: 0x7fff0ed36746 - std::panicking::default_hook
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\panicking.rs:298
10: 0x7ffefd62cecc - memchr
11: 0x7fff0ed370c7 - alloc::boxed::impl$50::call
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\alloc\src\boxed.rs:2077
12: 0x7fff0ed370c7 - std::panicking::rust_panic_with_hook
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\panicking.rs:799
13: 0x7fff0ed36f57 - std::panicking::begin_panic_handler::closure$0
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\panicking.rs:664
14: 0x7fff0ed3445f - std::sys_common::backtrace::__rust_end_short_backtrace
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\sys_common\backtrace.rs:171
15: 0x7fff0ed36c08 - std::panicking::begin_panic_handler
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\panicking.rs:652
16: 0x7fff0ed8e3c4 - core::panicking::panic_fmt
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\core\src\panicking.rs:72
17: 0x7fff0ed8e5be - core::panicking::panic_bounds_check
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\core\src\panicking.rs:274
18: 0x7ffefc2d3829 - ::pre_expansion_lint
19: 0x7ffefc324cf3 - as
rustc_codegen_llvm[cdc59ea1597e007a]::abi::FnAbiLlvmExt>::apply_attrs_callsite
20: 0x7ffef9529507 - llvm::DenseMap >::~DenseMap::compile_codegen_unit
22: 0x7ffef9511802 - llvm::DenseMap >::~DenseMap::codegen_crate
24: 0x7ffef94daab3 - rustc_interface[3b2f34fc053ae530]::passes::start_codegen
25: 0x7ffef94e3c60 - ::codegen_and_build_linker
26: 0x7ffef9493c2e - llvm::function_ref::callback_fn<`llvm::Value::stripInBoundsOffsets'::`1':: >
27: 0x7ffef9490def - llvm::function_ref::callback_fn<`llvm::Value::stripInBoundsOffsets'::`1':: >
28: 0x7ffef9498c49 - llvm::function_ref::callback_fn<`llvm::Value::stripInBoundsOffsets'::`1':: >
29: 0x7fff0ed4811d - alloc::boxed::impl$48::call_once
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\alloc\src\boxed.rs:2063
30: 0x7fff0ed4811d - alloc::boxed::impl$48::call_once
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\alloc\src\boxed.rs:2063
31: 0x7fff0ed4811d - std::sys::pal::windows::thread::impl$0::new::thread_start
at /rustc/36153f1a4e3162f0a143c7b3e468ecb3beb0008e/library\std\src\sys\pal\windows\thread.rs:52
32: 0x7fffdc76257d - BaseThreadInitThunk
33: 0x7fffdccaaa48 - RtlUserThreadStart
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 `C:\Users\jason\code\my-os\rustc-ice-2024-05-25T15_13_29-5792.txt` to your bug report
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]
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.80 (36153f1a 2024-05-24)
error: could not compile `kernel` (bin "kernel")
warning: build failed, waiting for other jobs to finish...
```