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

using if unsafe {...} { ... } causes ICE #121066

Closed
nyurik opened this issue Feb 14, 2024 · 1 comment
Closed

using if unsafe {...} { ... } causes ICE #121066

nyurik opened this issue Feb 14, 2024 · 1 comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nyurik
Copy link
Contributor

nyurik commented Feb 14, 2024

Code

See core lib change in https:/rust-lang/rust/pull/121064/files

Meta

Using x.py from a84bb95

rustc 1.77.0-beta.1 (04ba45219 2024-02-04) running on x86_64-unknown-linux-gnu

Error output

[<output>
](error: internal compiler error: /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/compiler/rustc_codegen_ssa/src/mir/operand.rs:201:18: not immediate: OperandRef(Ref((ptr:  %6 = alloca { { ptr, i64 }, { ptr, i64 }, { ptr, [1 x i64] } }, align 8), None, Align(8 bytes)) @ TyAndLayout { ty: Arguments<'_>, layout: Layout { size: Size(48 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: Aggregate { sized: true }, fields: Arbitrary { offsets: [Size(0 bytes), Size(32 bytes), Size(16 bytes)], memory_index: [0, 2, 1] }, largest_niche: Some(Niche { offset: Size(0 bytes), value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), variants: Single { index: 0 }, max_repr_align: None, unadjusted_abi_align: Align(8 bytes) } }))
Backtrace

thread 'rustc' panicked at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/compiler/rustc_errors/src/lib.rs:932:30:
  Box<dyn Any>
  stack backtrace:
     0:     0x7f07b0d8bd16 - std::backtrace_rs::backtrace::libunwind::trace::hc987f3c35d55761d
                                 at /rustc/04ba45[2197](https:/rust-lang/rust/actions/runs/7896056798/job/21549391196?pr=121064#step:26:2204)1a83d71477a406b5ce7a479e9d7af8/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
     1:     0x7f07b0d8bd16 - std::backtrace_rs::backtrace::trace_unsynchronized::h0adab636e703984a
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:     0x7f07b0d8bd16 - std::sys_common::backtrace::_print_fmt::h40f45f951b4ac7d7
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/std/src/sys_common/backtrace.rs:68:5
     3:     0x7f07b0d8bd16 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h598d4176dd756587
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/std/src/sys_common/backtrace.rs:44:22
     4:     0x7f07b0dde770 - core::fmt::rt::Argument::fmt::h427ca33a589c[2202](https:/rust-lang/rust/actions/runs/7896056798/job/21549391196?pr=121064#step:26:2209)
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/core/src/fmt/rt.rs:142:9
     5:     0x7f07b0dde770 - core::fmt::write::he2e4e385033a10d2
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/core/src/fmt/mod.rs:1120:17
     6:     0x7f07b0d7f61f - std::io::Write::write_fmt::h5d9d90611ed609ef
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/std/src/io/mod.rs:1846:15
     7:     0x7f07b0d8baf4 - std::sys_common::backtrace::_print::h37c713f895256a86
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/std/src/sys_common/backtrace.rs:47:5
     8:     0x7f07b0d8baf4 - std::sys_common::backtrace::print::hc99c64f387974770
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/std/src/sys_common/backtrace.rs:34:9
     9:     0x7f07b0d8e887 - std::panicking::default_hook::{{closure}}::hdf16b4533d11beb4
    10:     0x7f07b0d8e5e9 - std::panicking::default_hook::h223213ee257b8185
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/std/src/panicking.rs:292:9
    11:     0x7f07b39a896c - std[55ab4a542350c755]::panicking::update_hook::<alloc[4da3f6bd47afec24]::boxed::Box<rustc_driver_impl[ef4ee9058c24acfe]::install_ice_hook::{closure#0}>>::{closure#0}
    12:     0x7f07b0d8efd6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hff82162297b64e89
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/alloc/src/boxed.rs:2029:9
    13:     0x7f07b0d8efd6 - std::panicking::rust_panic_with_hook::h8633089b9015a8b7
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/std/src/panicking.rs:785:13
    14:     0x7f07b39d81d4 - std[55ab4a542350c755]::panicking::begin_panic::<rustc_errors[68df17d15f76634e]::ExplicitBug>::{closure#0}
    15:     0x7f07b39d48c6 - std[55ab4a542350c755]::sys_common::backtrace::__rust_end_short_backtrace::<std[55ab4a542350c755]::panicking::begin_panic<rustc_errors[68df17d15f76634e]::ExplicitBug>::{closure#0}, !>
    16:     0x7f07b39cfbb6 - std[55ab4a542350c755]::panicking::begin_panic::<rustc_errors[68df17d15f76634e]::ExplicitBug>
    17:     0x7f07b39e3841 - <rustc_errors[68df17d15f76634e]::diagnostic_builder::BugAbort as rustc_errors[68df17d15f76634e]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
    18:     0x7f07b3d725eb - <rustc_errors[68df17d15f76634e]::DiagCtxt>::bug::<alloc[4da3f6bd47afec24]::string::String>
    19:     0x7f07b3e0b23b - rustc_middle[cfc4b7b04cd03608]::util::bug::opt_span_bug_fmt::<rustc_span[70f6536c5e2f3755]::span_encoding::Span>::{closure#0}
    20:     0x7f07b3df3dba - rustc_middle[cfc4b7b04cd03608]::ty::context::tls::with_opt::<rustc_middle[cfc4b7b04cd03608]::util::bug::opt_span_bug_fmt<rustc_span[70f6536c5e2f3755]::span_encoding::Span>::{closure#0}, !>::{closure#0}
    21:     0x7f07b3df3c38 - rustc_middle[cfc4b7b04cd03608]::ty::context::tls::with_context_opt::<rustc_middle[cfc4b7b04cd03608]::ty::context::tls::with_opt<rustc_middle[cfc4b7b04cd03608]::util::bug::opt_span_bug_fmt<rustc_span[70f6536c5e2f3755]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
    22:     0x7f07b1f07430 - rustc_middle[cfc4b7b04cd03608]::util::bug::bug_fmt
    23:     0x7f07b574e82a - <rustc_codegen_llvm[103398a9ca8f425b]::builder::Builder as rustc_codegen_ssa[725a152d682a010f]::traits::intrinsic::IntrinsicCallMethods>::codegen_intrinsic_call
    24:     0x7f07b57551a5 - <rustc_codegen_ssa[725a152d682a010f]::mir::FunctionCx<rustc_codegen_llvm[103398a9ca8f425b]::builder::Builder>>::codegen_intrinsic_call
    25:     0x7f07b558ea63 - <rustc_codegen_ssa[725a152d682a010f]::mir::FunctionCx<rustc_codegen_llvm[103398a9ca8f425b]::builder::Builder>>::codegen_block
    26:     0x7f07b57404a6 - rustc_codegen_ssa[725a152d682a010f]::mir::codegen_mir::<rustc_codegen_llvm[103398a9ca8f425b]::builder::Builder>
    27:     0x7f07b572e561 - rustc_codegen_llvm[103398a9ca8f425b]::base::compile_codegen_unit::module_codegen
    28:     0x7f07b59b7f85 - <rustc_codegen_llvm[103398a9ca8f425b]::LlvmCodegenBackend as rustc_codegen_ssa[725a152d682a010f]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
    29:     0x7f07b5b08467 - <rustc_codegen_llvm[103398a9ca8f425b]::LlvmCodegenBackend as rustc_codegen_ssa[725a152d682a010f]::traits::backend::CodegenBackend>::codegen_crate
    30:     0x7f07b5b06230 - rustc_interface[2106013cc2f5b63c]::passes::start_codegen
    31:     0x7f07b5b05a06 - <rustc_interface[2106013cc2f5b63c]::queries::Queries>::codegen_and_build_linker
    32:     0x7f07b5993de6 - rustc_interface[2106013cc2f5b63c]::interface::run_compiler::<core[ce9c323f7905c200]::result::Result<(), rustc_span[70f6536c5e2f3755]::ErrorGuaranteed>, rustc_driver_impl[ef4ee9058c24acfe]::run_compiler::{closure#0}>::{closure#0}
    33:     0x7f07b5b01ba1 - std[55ab4a542350c755]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2106013cc2f5b63c]::util::run_in_thread_with_globals<rustc_interface[2106013cc2f5b63c]::interface::run_compiler<core[ce9c323f7905c200]::result::Result<(), rustc_span[70f6536c5e2f3755]::ErrorGuaranteed>, rustc_driver_impl[ef4ee9058c24acfe]::run_compiler::{closure#0}>::{closure#0}, core[ce9c323f7905c200]::result::Result<(), rustc_span[70f6536c5e2f3755]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ce9c323f7905c200]::result::Result<(), rustc_span[70f6536c5e2f3755]::ErrorGuaranteed>>
    34:     0x7f07b5b019ff - <<std[55ab4a542350c755]::thread::Builder>::spawn_unchecked_<rustc_interface[2106013cc2f5b63c]::util::run_in_thread_with_globals<rustc_interface[2106013cc2f5b63c]::interface::run_compiler<core[ce9c323f7905c200]::result::Result<(), rustc_span[70f6536c5e2f3755]::ErrorGuaranteed>, rustc_driver_impl[ef4ee9058c24acfe]::run_compiler::{closure#0}>::{closure#0}, core[ce9c323f7905c200]::result::Result<(), rustc_span[70f6536c5e2f3755]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ce9c323f7905c200]::result::Result<(), rustc_span[70f6536c5e2f3755]::ErrorGuaranteed>>::{closure#1} as core[ce9c323f7905c200]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
    35:     0x7f07b0d98675 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf8f17589d536646e
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/alloc/src/boxed.rs:2015:9
    36:     0x7f07b0d98675 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h68da270e7d912a3c
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/alloc/src/boxed.rs:2015:9
    37:     0x7f07b0d98675 - std::sys::pal::unix::thread::Thread::new::thread_start::he371c43bd596b52d
                                 at /rustc/04ba4521971a83d71477a406b5ce7a479e9d7af8/library/std/src/sys/pal/unix/thread.rs:108:17
    38:     0x7f07b0b636ba - <unknown>
    39:     0x7f07b0bf2120 - <unknown>
    40:                0x0 - <unknown>
  
  note: we would appreciate a bug report: https:/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
  
  warning: the ICE couldn't be written to `/checkout/rustc-ice-2024-02-14T03_25_45-1890.txt`: Read-only file system (os error 30)
  
  note: rustc 1.77.0-beta.1 (04ba45219 2024-02-04) running on x86_64-unknown-linux-gnu

@nyurik nyurik added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 14, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 14, 2024
@Noratrieb
Copy link
Member

This is related to is_val_statically_known, which is an intrinsic. We don't track bad error messages for intrinsics as bugs, so I'm going to close this.
But in this case, feel free to open a PR with a better panic message.

@Noratrieb Noratrieb closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants