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: layout error: SizeOverflow([u8; 18446744073709551615]), compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs:77:78 #94961

Closed
matthiaskrgr opened this issue Mar 15, 2022 · 2 comments · Fixed by #94997
Assignees
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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

@matthiaskrgr
Copy link
Member

Code

code from glacier fixed/75158.rs

struct S<T> { x: [T; !0] }

pub fn f() -> usize {
    std::mem::size_of::<S<u8>>()
}

fn main() {
    let x = f();
}

Meta

rustc --version --verbose:

rustc 1.61.0-nightly (040703018 2022-03-15)
binary: rustc
commit-hash: 040703018c51409ea8c9a0cfb8f829a138d2a411
commit-date: 2022-03-15
host: x86_64-unknown-linux-gnu
release: 1.61.0-nightly
LLVM version: 14.0.0

with 0407030 cc @michaelwoerister

Error output

~/.rustup/toolchains/master/bin/rustc ./75158.rs -Cdebuginfo=2

warning: unused variable: `x`
 --> ./75158.rs:8:9
  |
8 |     let x = f();
  |         ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: field is never read: `x`
 --> ./75158.rs:1:15
  |
1 | struct S<T> { x: [T; !0] }
  |               ^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

thread 'rustc' panicked at 'layout error: SizeOverflow([u8; 18446744073709551615])', compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs:77:78
stack backtrace:
Backtrace

thread 'rustc' panicked at 'layout error: SizeOverflow([u8; 18446744073709551615])', compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs:77:78
stack backtrace:
   0:     0x7f5322a9d9dd - std::backtrace_rs::backtrace::libunwind::trace::haf4ecdfa3f01e239
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f5322a9d9dd - std::backtrace_rs::backtrace::trace_unsynchronized::hdb7a02753cf575e6
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f5322a9d9dd - std::sys_common::backtrace::_print_fmt::h4e04cf54c6b62f34
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f5322a9d9dd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h431e9268b405aa45
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f5322af74bc - core::fmt::write::h7b9e1ecd6bccaead
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/core/src/fmt/mod.rs:1190:17
   5:     0x7f5322a8ef61 - std::io::Write::write_fmt::h69aff9a7bbde96a2
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/io/mod.rs:1655:15
   6:     0x7f5322aa0a55 - std::sys_common::backtrace::_print::h6757821b3f393ae6
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f5322aa0a55 - std::sys_common::backtrace::print::hae1936f53e077a1d
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f5322aa0a55 - std::panicking::default_hook::{{closure}}::h40c71ec571d26d13
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/panicking.rs:295:22
   9:     0x7f5322aa0709 - std::panicking::default_hook::h60f0f3901baefdcd
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/panicking.rs:314:9
  10:     0x7f53232caa71 - rustc_driver[1b268baf83766c67]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f5322aa11a0 - std::panicking::rust_panic_with_hook::h5dd317560ad4aa60
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/panicking.rs:702:17
  12:     0x7f5322aa0fd7 - std::panicking::begin_panic_handler::{{closure}}::h08010b18b6b0c465
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/panicking.rs:588:13
  13:     0x7f5322a9de94 - std::sys_common::backtrace::__rust_end_short_backtrace::h2f3576a6567fe14b
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f5322aa0d09 - rust_begin_unwind
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/panicking.rs:584:5
  15:     0x7f5322a64c93 - core::panicking::panic_fmt::h487d0a5977e52dd8
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/core/src/panicking.rs:143:14
  16:     0x7f5322a64d83 - core::result::unwrap_failed::h18c9fa1e545e37b1
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/core/src/result.rs:1784:5
  17:     0x7f5324c78a33 - rustc_codegen_ssa[61c52b89a0e7710f]::debuginfo::type_names::push_debuginfo_type_name
  18:     0x7f5324c7a803 - rustc_codegen_ssa[61c52b89a0e7710f]::debuginfo::type_names::push_generic_params_internal
  19:     0x7f5324c7b88b - rustc_codegen_ssa[61c52b89a0e7710f]::debuginfo::type_names::push_generic_params
  20:     0x7f5324506b1f - <rustc_codegen_llvm[e7d82652c8ee1835]::context::CodegenCx as rustc_codegen_ssa[61c52b89a0e7710f]::traits::debuginfo::DebugInfoMethods>::dbg_scope_fn
  21:     0x7f5324532412 - rustc_codegen_ssa[61c52b89a0e7710f]::mir::codegen_mir::<rustc_codegen_llvm[e7d82652c8ee1835]::builder::Builder>
  22:     0x7f53244f0de4 - rustc_codegen_llvm[e7d82652c8ee1835]::base::compile_codegen_unit::module_codegen
  23:     0x7f53251ae136 - <rustc_query_system[c221bbeaef7718bc]::dep_graph::graph::DepGraph<rustc_middle[5cb2a2baeb7120e8]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[5cb2a2baeb7120e8]::ty::context::TyCtxt, rustc_span[5f05f834f379cca1]::symbol::Symbol, rustc_codegen_ssa[61c52b89a0e7710f]::ModuleCodegen<rustc_codegen_llvm[e7d82652c8ee1835]::ModuleLlvm>>
  24:     0x7f532519ce69 - rustc_codegen_llvm[e7d82652c8ee1835]::base::compile_codegen_unit
  25:     0x7f532518b0dc - <rustc_codegen_llvm[e7d82652c8ee1835]::LlvmCodegenBackend as rustc_codegen_ssa[61c52b89a0e7710f]::traits::backend::CodegenBackend>::codegen_crate
  26:     0x7f532516c477 - <rustc_session[61b3ef2dc04039f5]::session::Session>::time::<alloc[a45cc59c22f1661f]::boxed::Box<dyn core[ad15741df00aa94f]::any::Any>, rustc_interface[df7c0df4393bd4c6]::passes::start_codegen::{closure#0}>
  27:     0x7f532515aee8 - <rustc_interface[df7c0df4393bd4c6]::passes::QueryContext>::enter::<<rustc_interface[df7c0df4393bd4c6]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[ad15741df00aa94f]::result::Result<alloc[a45cc59c22f1661f]::boxed::Box<dyn core[ad15741df00aa94f]::any::Any>, rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>>
  28:     0x7f53251538bf - <rustc_interface[df7c0df4393bd4c6]::queries::Queries>::ongoing_codegen
  29:     0x7f532511733b - <rustc_interface[df7c0df4393bd4c6]::interface::Compiler>::enter::<rustc_driver[1b268baf83766c67]::run_compiler::{closure#1}::{closure#2}, core[ad15741df00aa94f]::result::Result<core[ad15741df00aa94f]::option::Option<rustc_interface[df7c0df4393bd4c6]::queries::Linker>, rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>>
  30:     0x7f532512a3af - rustc_span[5f05f834f379cca1]::with_source_map::<core[ad15741df00aa94f]::result::Result<(), rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>, rustc_interface[df7c0df4393bd4c6]::interface::create_compiler_and_run<core[ad15741df00aa94f]::result::Result<(), rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>, rustc_driver[1b268baf83766c67]::run_compiler::{closure#1}>::{closure#1}>
  31:     0x7f5325129bb4 - rustc_interface[df7c0df4393bd4c6]::interface::create_compiler_and_run::<core[ad15741df00aa94f]::result::Result<(), rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>, rustc_driver[1b268baf83766c67]::run_compiler::{closure#1}>
  32:     0x7f5325114d32 - <scoped_tls[3aaa66680d960588]::ScopedKey<rustc_span[5f05f834f379cca1]::SessionGlobals>>::set::<rustc_interface[df7c0df4393bd4c6]::interface::run_compiler<core[ad15741df00aa94f]::result::Result<(), rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>, rustc_driver[1b268baf83766c67]::run_compiler::{closure#1}>::{closure#0}, core[ad15741df00aa94f]::result::Result<(), rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>>
  33:     0x7f53251131ef - std[9cd569cf860e2c78]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[df7c0df4393bd4c6]::util::run_in_thread_pool_with_globals<rustc_interface[df7c0df4393bd4c6]::interface::run_compiler<core[ad15741df00aa94f]::result::Result<(), rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>, rustc_driver[1b268baf83766c67]::run_compiler::{closure#1}>::{closure#0}, core[ad15741df00aa94f]::result::Result<(), rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>>::{closure#0}, core[ad15741df00aa94f]::result::Result<(), rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>>
  34:     0x7f532512b332 - <<std[9cd569cf860e2c78]::thread::Builder>::spawn_unchecked_<rustc_interface[df7c0df4393bd4c6]::util::run_in_thread_pool_with_globals<rustc_interface[df7c0df4393bd4c6]::interface::run_compiler<core[ad15741df00aa94f]::result::Result<(), rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>, rustc_driver[1b268baf83766c67]::run_compiler::{closure#1}>::{closure#0}, core[ad15741df00aa94f]::result::Result<(), rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>>::{closure#0}, core[ad15741df00aa94f]::result::Result<(), rustc_errors[a64c559d08c194a6]::ErrorGuaranteed>>::{closure#1} as core[ad15741df00aa94f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35:     0x7f5322aab333 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcc7a04ee0fd9c550
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/alloc/src/boxed.rs:1853:9
  36:     0x7f5322aab333 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h302eba8ea41ed4e3
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/alloc/src/boxed.rs:1853:9
  37:     0x7f5322aab333 - std::sys::unix::thread::Thread::new::thread_start::h88a2cc55b0f1463e
                               at /rustc/040703018c51409ea8c9a0cfb8f829a138d2a411/library/std/src/sys/unix/thread.rs:108:17
  38:     0x7f53228835c2 - start_thread
  39:     0x7f5322908584 - __clone
  40:                0x0 - <unknown>

error: internal compiler error: unexpected panic

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.61.0-nightly (040703018 2022-03-15) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2

query stack during panic:
end of query stack
warning: 2 warnings emitted

@matthiaskrgr matthiaskrgr 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. C-bug Category: This is a bug. A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) labels Mar 15, 2022
@matthiaskrgr
Copy link
Member Author

This would previously just throw an error but not "crash":

error: values of the type `[u8; 18446744073709551615]` are too big for the current architecture

error: aborting due to previous error; 2 warnings emitted

@michaelwoerister michaelwoerister self-assigned this Mar 15, 2022
@michaelwoerister
Copy link
Member

I'll look into it. Thanks for the bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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.

3 participants