Open
Description
auto-reduced (treereduce-rust):
//@compile-flags: --crate-type lib
#![feature(repr_simd)]
const C: usize = 16;
#[repr(simd)]
pub struct Foo([u8; C]);
pub unsafe fn foo(a: Foo) {}
fn main() {}
original:
//! This is a regression test to ensure that we evaluate
//! SIMD vector length constants instead of assuming they are literals.
//@ only-x86_64
//@ check-pass
#![feature(repr_simd)]
const C: usize = 16;
#[repr(simd)]
#[derive(Copy, Clone)]
pub struct Foo([u8; C]);
pub unsafe fn foo(a: Foo) {
std::str::from_utf8_unchecked(&[99, 108, 105, 112, 112, 121]);
str::from_utf8_unchecked(&[99, 108, 105, 112, 112, 121]);
std::str::from_utf8_unchecked(&[b'c', b'l', b'i', b'p', b'p', b'y']);
str::from_utf8_unchecked(&[b'c', b'l', b'i', b'p', b'p', b'y']);
std::str::from_utf8_unchecked(b"clippy");
str::from_utf8_unchecked(b"clippy");
let x = 0xA0;
std::str::from_utf8_unchecked(&[0xC0, x]);
str::from_utf8_unchecked(&[0xC0, x]);
}
fn main() {}
Version information
rustc 1.87.0-nightly (fd17deacc 2025-03-04)
binary: rustc
commit-hash: fd17deacce374a4185c882795be162e17b557050
commit-date: 2025-03-04
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0
Possibly related line of code:
rust/compiler/rustc_codegen_llvm/src/context.rs
Lines 1279 to 1291 in fd17dea
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2 -Clink-dead-code=true -Zvalidate-mir --edition=2024
Program output
warning: unused variable: `a`
--> /tmp/icemaker_global_tempdir.ROUzTbiGr8Hi/rustc_testrunner_tmpdir_reporting.XbcWx4r0xnnE/mvce.rs:9:19
|
9 | pub unsafe fn foo(a: Foo) {}
| ^ help: if this is intentional, prefix it with an underscore: `_a`
|
= note: `#[warn(unused_variables)]` on by default
error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:1285:21: `fn_abi_of_instance(foo, [])` failed: Layout(Unknown(Foo))
--> /tmp/icemaker_global_tempdir.ROUzTbiGr8Hi/rustc_testrunner_tmpdir_reporting.XbcWx4r0xnnE/mvce.rs:9:1
|
9 | pub unsafe fn foo(a: Foo) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
thread 'rustc' panicked at compiler/rustc_codegen_llvm/src/context.rs:1285:21:
Box<dyn Any>
stack backtrace:
0: 0x7421787dad94 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h38d103f25b5fc9da
1: 0x7421790057e2 - core::fmt::write::h51e5c982d87d838d
2: 0x74217a2d4511 - std::io::Write::write_fmt::h24e7c9ef42bcecab
3: 0x7421787dabf2 - std::sys::backtrace::BacktraceLock::print::h2f36236a0c89f5ad
4: 0x7421787dd4d2 - std::panicking::default_hook::{{closure}}::hfa3a01d30bf38a16
5: 0x7421787dd0c4 - std::panicking::default_hook::h73a43ec84dfb2d2e
6: 0x74217792bdd7 - std[5b59e6f68f39e4a3]::panicking::update_hook::<alloc[a5cfa563521ef073]::boxed::Box<rustc_driver_impl[3a7877a37badcc56]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7421787ddd43 - std::panicking::rust_panic_with_hook::h7086c047409dd55a
8: 0x7421779683b1 - std[5b59e6f68f39e4a3]::panicking::begin_panic::<rustc_errors[e91cd7d082a11be2]::ExplicitBug>::{closure#0}
9: 0x74217795c7c6 - std[5b59e6f68f39e4a3]::sys::backtrace::__rust_end_short_backtrace::<std[5b59e6f68f39e4a3]::panicking::begin_panic<rustc_errors[e91cd7d082a11be2]::ExplicitBug>::{closure#0}, !>
10: 0x74217795c5a7 - std[5b59e6f68f39e4a3]::panicking::begin_panic::<rustc_errors[e91cd7d082a11be2]::ExplicitBug>
11: 0x742177971ec1 - <rustc_errors[e91cd7d082a11be2]::diagnostic::BugAbort as rustc_errors[e91cd7d082a11be2]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x742177ec513c - <rustc_errors[e91cd7d082a11be2]::DiagCtxtHandle>::span_bug::<rustc_span[c14b644df6d3ab3c]::span_encoding::Span, alloc[a5cfa563521ef073]::string::String>
13: 0x742177f4d66a - rustc_middle[20fb34f80dd5af75]::util::bug::opt_span_bug_fmt::<rustc_span[c14b644df6d3ab3c]::span_encoding::Span>::{closure#0}
14: 0x742177f34f7a - rustc_middle[20fb34f80dd5af75]::ty::context::tls::with_opt::<rustc_middle[20fb34f80dd5af75]::util::bug::opt_span_bug_fmt<rustc_span[c14b644df6d3ab3c]::span_encoding::Span>::{closure#0}, !>::{closure#0}
15: 0x742177f34deb - rustc_middle[20fb34f80dd5af75]::ty::context::tls::with_context_opt::<rustc_middle[20fb34f80dd5af75]::ty::context::tls::with_opt<rustc_middle[20fb34f80dd5af75]::util::bug::opt_span_bug_fmt<rustc_span[c14b644df6d3ab3c]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
16: 0x74217685e107 - rustc_middle[20fb34f80dd5af75]::util::bug::span_bug_fmt::<rustc_span[c14b644df6d3ab3c]::span_encoding::Span>
17: 0x7421777b168d - <rustc_codegen_llvm[c860875266de27e1]::context::CodegenCx as rustc_middle[20fb34f80dd5af75]::ty::layout::FnAbiOfHelpers>::handle_fn_abi_err
18: 0x7421777899ea - <rustc_codegen_llvm[c860875266de27e1]::context::CodegenCx as rustc_middle[20fb34f80dd5af75]::ty::layout::FnAbiOf>::fn_abi_of_instance::{closure#0}
19: 0x742179a9ee24 - <rustc_codegen_llvm[c860875266de27e1]::context::CodegenCx as rustc_codegen_ssa[3de69e11977865d2]::traits::declare::PreDefineCodegenMethods>::predefine_fn
20: 0x742179aa1323 - rustc_codegen_llvm[c860875266de27e1]::base::compile_codegen_unit::module_codegen
21: 0x74217a0877d0 - <rustc_codegen_llvm[c860875266de27e1]::LlvmCodegenBackend as rustc_codegen_ssa[3de69e11977865d2]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
22: 0x74217a088d57 - <rustc_codegen_llvm[c860875266de27e1]::LlvmCodegenBackend as rustc_codegen_ssa[3de69e11977865d2]::traits::backend::CodegenBackend>::codegen_crate
23: 0x74217a07ed73 - <rustc_interface[2148282fb0834f58]::queries::Linker>::codegen_and_build_linker
24: 0x74217a079b30 - rustc_interface[2148282fb0834f58]::passes::create_and_enter_global_ctxt::<core[436ac50667b45076]::option::Option<rustc_interface[2148282fb0834f58]::queries::Linker>, rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
25: 0x74217a0f19e0 - rustc_interface[2148282fb0834f58]::interface::run_compiler::<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}
26: 0x742179f20608 - std[5b59e6f68f39e4a3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
27: 0x742179f20ef4 - <<std[5b59e6f68f39e4a3]::thread::Builder>::spawn_unchecked_<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[436ac50667b45076]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
28: 0x742179f222f7 - std::sys::pal::unix::thread::Thread::new::thread_start::hbb5e0f14d5ca8b98
29: 0x7421740a370a - <unknown>
30: 0x742174127aac - <unknown>
31: 0x0 - <unknown>
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.87.0-nightly (fd17deacc 2025-03-04) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z incremental-verify-ich=yes -C incremental=[REDACTED] -C debuginfo=2 -C link-dead-code=true -Z validate-mir
query stack during panic:
end of query stack
error: aborting due to 1 previous error; 1 warning emitted
Metadata
Metadata
Assignees
Labels
Area: Memory layout of typesArea: the `#[repr(stuff)]` attributeCategory: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.