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

miri ICEs on too large types where rustc just errors #2088

Closed
matthiaskrgr opened this issue Apr 27, 2022 · 0 comments · Fixed by #2093
Closed

miri ICEs on too large types where rustc just errors #2088

matthiaskrgr opened this issue Apr 27, 2022 · 0 comments · Fixed by #2093

Comments

@matthiaskrgr
Copy link
Member

fn main() {
    let _fat: [u8; (1<<61)+(1<<31)] = //~ ERROR too big for the current architecture
        [0; (1u64<<61) as usize +(1u64<<31) as usize];
}

rustc: "I see what you did there":smirk:

error: values of the type `[u8; 2305843011361177600]` are too big for the current architecture
 --> src/main.rs:2:9
  |
2 |     let _fat: [u8; (1<<61)+(1<<31)] = //~ ERROR too big for the current architecture
  |         ^^^^

error: aborting due to previous error

miri: 😱

error: internal compiler error: src/tools/miri/src/diagnostics.rs:190:21: This error should be impossible in Miri: values of the type `[u8; 2305843011361177600]` are too big for the current architecture

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/compiler/rustc_errors/src/lib.rs:1313:9
stack backtrace:
   0:     0x7fc5dae9dfcd - std::backtrace_rs::backtrace::libunwind::trace::h008bfa4d47668920
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fc5dae9dfcd - std::backtrace_rs::backtrace::trace_unsynchronized::h27b8baa167def365
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fc5dae9dfcd - std::sys_common::backtrace::_print_fmt::h14cfba2b17ab0c8e
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fc5dae9dfcd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hcc0f07ba1953872c
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fc5daef9d4c - core::fmt::write::heefc9b0106ff4b26
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/core/src/fmt/mod.rs:1194:17
   5:     0x7fc5dae8f6c1 - std::io::Write::write_fmt::h17f586ea6872643e
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/io/mod.rs:1655:15
   6:     0x7fc5daea0ce5 - std::sys_common::backtrace::_print::h1d24983408f9dcb5
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fc5daea0ce5 - std::sys_common::backtrace::print::h3dfa044f75ad3854
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fc5daea0ce5 - std::panicking::default_hook::{{closure}}::h0d1e2fd3193b7c66
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/panicking.rs:295:22
   9:     0x7fc5daea0959 - std::panicking::default_hook::ha7798f571e103017
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/panicking.rs:314:9
  10:     0x7fc5db6ce721 - rustc_driver[24333cd5cdbff7]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fc5daea14b6 - std::panicking::rust_panic_with_hook::hd4ae5780d84eaeb3
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/panicking.rs:702:17
  12:     0x7fc5dc76d211 - std[e3663ace07a47676]::panicking::begin_panic::<rustc_errors[444e5733760837c]::ExplicitBug>::{closure#0}
  13:     0x7fc5dc76cb26 - std[e3663ace07a47676]::sys_common::backtrace::__rust_end_short_backtrace::<std[e3663ace07a47676]::panicking::begin_panic<rustc_errors[444e5733760837c]::ExplicitBug>::{closure#0}, !>
  14:     0x7fc5dc6c7b5f - std[e3663ace07a47676]::panicking::begin_panic::<rustc_errors[444e5733760837c]::ExplicitBug>
  15:     0x7fc5dc681726 - std[e3663ace07a47676]::panic::panic_any::<rustc_errors[444e5733760837c]::ExplicitBug>
  16:     0x7fc5dc67adc5 - <rustc_errors[444e5733760837c]::HandlerInner>::bug::<&alloc[3a33fef0fcfbda16]::string::String>
  17:     0x7fc5dc67a7d0 - <rustc_errors[444e5733760837c]::Handler>::bug::<&alloc[3a33fef0fcfbda16]::string::String>
  18:     0x7fc5dc77376d - rustc_middle[78f77a4b50da5456]::ty::context::tls::with_opt::<rustc_middle[78f77a4b50da5456]::util::bug::opt_span_bug_fmt<rustc_span[ae3b8a4be6f596eb]::span_encoding::Span>::{closure#0}, ()>
  19:     0x7fc5dc773946 - rustc_middle[78f77a4b50da5456]::util::bug::opt_span_bug_fmt::<rustc_span[ae3b8a4be6f596eb]::span_encoding::Span>
  20:     0x7fc5dc7738b3 - rustc_middle[78f77a4b50da5456]::util::bug::bug_fmt
  21:     0x55c3e7af314d - miri[7adf390157a6bbd]::diagnostics::report_error
  22:     0x55c3e7af9ae3 - miri[7adf390157a6bbd]::eval::eval_entry
  23:     0x55c3e7a6585b - <rustc_interface[e01f10fbcfbe47c5]::passes::QueryContext>::enter::<<miri[3f3a2e771ed60824]::MiriCompilerCalls as rustc_driver[24333cd5cdbff7]::Callbacks>::after_analysis::{closure#0}, ()>
  24:     0x55c3e7a684ce - <miri[3f3a2e771ed60824]::MiriCompilerCalls as rustc_driver[24333cd5cdbff7]::Callbacks>::after_analysis
  25:     0x7fc5dd712f75 - <rustc_interface[e01f10fbcfbe47c5]::interface::Compiler>::enter::<rustc_driver[24333cd5cdbff7]::run_compiler::{closure#1}::{closure#2}, core[373cc1b435eedd77]::result::Result<core[373cc1b435eedd77]::option::Option<rustc_interface[e01f10fbcfbe47c5]::queries::Linker>, rustc_errors[444e5733760837c]::ErrorGuaranteed>>
  26:     0x7fc5dd73c73f - rustc_span[ae3b8a4be6f596eb]::with_source_map::<core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>, rustc_interface[e01f10fbcfbe47c5]::interface::create_compiler_and_run<core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>, rustc_driver[24333cd5cdbff7]::run_compiler::{closure#1}>::{closure#1}>
  27:     0x7fc5dd727234 - rustc_interface[e01f10fbcfbe47c5]::interface::create_compiler_and_run::<core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>, rustc_driver[24333cd5cdbff7]::run_compiler::{closure#1}>
  28:     0x7fc5dd710292 - <scoped_tls[8d6377a96f770454]::ScopedKey<rustc_span[ae3b8a4be6f596eb]::SessionGlobals>>::set::<rustc_interface[e01f10fbcfbe47c5]::interface::run_compiler<core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>, rustc_driver[24333cd5cdbff7]::run_compiler::{closure#1}>::{closure#0}, core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>>
  29:     0x7fc5dd7370af - std[e3663ace07a47676]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e01f10fbcfbe47c5]::util::run_in_thread_pool_with_globals<rustc_interface[e01f10fbcfbe47c5]::interface::run_compiler<core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>, rustc_driver[24333cd5cdbff7]::run_compiler::{closure#1}>::{closure#0}, core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>>::{closure#0}, core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>>
  30:     0x7fc5dd7296a9 - <<std[e3663ace07a47676]::thread::Builder>::spawn_unchecked_<rustc_interface[e01f10fbcfbe47c5]::util::run_in_thread_pool_with_globals<rustc_interface[e01f10fbcfbe47c5]::interface::run_compiler<core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>, rustc_driver[24333cd5cdbff7]::run_compiler::{closure#1}>::{closure#0}, core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>>::{closure#0}, core[373cc1b435eedd77]::result::Result<(), rustc_errors[444e5733760837c]::ErrorGuaranteed>>::{closure#1} as core[373cc1b435eedd77]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x7fc5daeab403 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::haef26bcd4f755601
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/alloc/src/boxed.rs:1866:9
  32:     0x7fc5daeab403 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3a96fd989239d901
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/alloc/src/boxed.rs:1866:9
  33:     0x7fc5daeab403 - std::sys::unix::thread::Thread::new::thread_start::h13804fa7b9eb440b
                               at /rustc/082e4ca49770ebc9cb0ee616f3726a67471be8cb/library/std/src/sys/unix/thread.rs:108:17
  34:     0x7fc5dac835c2 - start_thread
  35:     0x7fc5dad08584 - __clone
  36:                0x0 - <unknown>

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

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: rustc 1.62.0-nightly (082e4ca49 2022-04-26) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental -C target-cpu=native

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

query stack during panic:
end of query stack
error: aborting due to previous error

Maybe miri could handle these more gracefully, or just bail as rustc does? 🙃

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

Successfully merging a pull request may close this issue.

1 participant