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

ICE: [u8; 18446744073709551615] is too big for the current architecture #69485

Closed
DutchGhost opened this issue Feb 26, 2020 · 0 comments · Fixed by #69881
Closed

ICE: [u8; 18446744073709551615] is too big for the current architecture #69485

DutchGhost opened this issue Feb 26, 2020 · 0 comments · Fixed by #69881
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

@DutchGhost
Copy link
Contributor

DutchGhost commented Feb 26, 2020

I tried this code:

enum Bug {
    V([u8; !0]),
}

I expected to see this happen: Complain that the array size is too large

Instead, this happened: It crashed the compiler

Meta

rustc --version --verbose:

stable 1.41.0 (5e1a79984 2020-01-27)
beta 1.42.0-beta.4 (13e0fbc20 2020-02-24)
nightly 1.43.0-nightly (6fd8798f4 2020-02-25)

A quick look at Godbolt suggests this has been happening from 1.12 onwards.

Backtrace

rror: internal compiler error: src/librustc_lint/types.rs:1017: failed to get layout for `Bug`: the type `[u8; 18446744073709551615]` is too big for the current architecture

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:883:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:476
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::bug
  14: rustc_errors::Handler::bug
  15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  16: rustc::ty::context::tls::with_opt::{{closure}}
  17: rustc::ty::context::tls::with_opt
  18: rustc::util::bug::opt_span_bug_fmt
  19: rustc::util::bug::bug_fmt
  20: <rustc_lint::types::VariantSizeDifferences as rustc_lint::passes::LateLintPass>::check_item
  21: <rustc_lint::BuiltinCombinedModuleLateLintPass as rustc_lint::passes::LateLintPass>::check_item
  22: rustc_hir::intravisit::Visitor::visit_nested_item
  23: rustc_hir::intravisit::walk_mod
  24: rustc_lint::late::late_lint_mod
  25: rustc::ty::query::__query_compute::lint_mod
  26: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::lint_mod>::compute
  27: rustc::dep_graph::graph::DepGraph::with_task_impl
  28: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  29: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
  30: rustc_session::utils::<impl rustc_session::session::Session>::time
  31: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:86
  32: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  33: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:86
  34: rustc_session::utils::<impl rustc_session::session::Session>::time
  35: rustc_interface::passes::analysis
  36: rustc::ty::query::__query_compute::analysis
  37: rustc::dep_graph::graph::DepGraph::with_task_impl
  38: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  39: rustc::ty::context::tls::enter_global
  40: rustc_interface::interface::run_compiler_in_existing_thread_pool
  41: scoped_tls::ScopedKey<T>::set
  42: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.42.0-beta.4 (13e0fbc20 2020-02-24) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type lib

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

query stack during panic:
#0 [lint_mod] linting top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

Related issues: #23600, #49230

@DutchGhost DutchGhost added the C-bug Category: This is a bug. label Feb 26, 2020
@jonas-schievink jonas-schievink added 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 26, 2020
Centril added a commit to Centril/rust that referenced this issue Mar 11, 2020
VariantSizeDifferences: bail on SizeOverflow

Fixes rust-lang#69485.

r? @oli-obk
Centril added a commit to Centril/rust that referenced this issue Mar 16, 2020
VariantSizeDifferences: bail on SizeOverflow

Fixes rust-lang#69485.

r? @oli-obk
Centril added a commit to Centril/rust that referenced this issue Mar 16, 2020
VariantSizeDifferences: bail on SizeOverflow

Fixes rust-lang#69485.

r? @oli-obk
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 17, 2020
VariantSizeDifferences: bail on SizeOverflow

Fixes rust-lang#69485.

r? @oli-obk
@bors bors closed this as completed in 1b0c73b Mar 17, 2020
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

Successfully merging a pull request may close this issue.

2 participants