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: repr 128 + debuginfo #100612

Closed
matthiaskrgr opened this issue Aug 16, 2022 · 4 comments
Closed

ICE: repr 128 + debuginfo #100612

matthiaskrgr opened this issue Aug 16, 2022 · 4 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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

./src/test/ui/enum-discriminant/issue-70509-partial_eq.rs

Code

// run-pass
#![feature(repr128, arbitrary_enum_discriminant)]
//~^ WARN the feature `repr128` is incomplete

#[derive(PartialEq, Debug)]
#[repr(i128)]
enum Test {
    A(Box<u64>) = 0,
    B(usize) = u64::MAX as i128 + 1,
}

fn main() {
    assert_ne!(Test::A(Box::new(2)), Test::B(0));
    // This previously caused a segfault.
    //
    // See https://github.com/rust-lang/rust/issues/70509#issuecomment-620654186
    // for a detailed explanation.
}

Meta

rustc --version --verbose:

rustc 1.65.0-nightly (3694b7d30 2022-08-15)
binary: rustc
commit-hash: 3694b7d307b7516757651952b30bb97b6ba5c049
commit-date: 2022-08-15
host: x86_64-unknown-linux-gnu
release: 1.65.0-nightly
LLVM version: 15.0.0

Error output

warning: the feature `repr128` is incomplete and may not be safe to use and/or cause compiler crashes
 --> ./src/test/ui/enum-discriminant/issue-70509-partial_eq.rs:2:12
  |
2 | #![feature(repr128, arbitrary_enum_discriminant)]
  |            ^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #56071 <https://github.com/rust-lang/rust/issues/56071> for more information
Backtrace

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `0`,
 right: `18446744073709551616`', compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs:420:17
stack backtrace:
   0:     0x7f99a88431f0 - std::backtrace_rs::backtrace::libunwind::trace::h10917c1ed3d6c238
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f99a88431f0 - std::backtrace_rs::backtrace::trace_unsynchronized::heeab8f99cfbb8234
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f99a88431f0 - std::sys_common::backtrace::_print_fmt::hc15f6dc8a7749c4f
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f99a88431f0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9c4389168d6e66ed
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f99a889e28e - core::fmt::write::h0d4a3564d025cb67
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/core/src/fmt/mod.rs:1202:17
   5:     0x7f99a8833f05 - std::io::Write::write_fmt::h04a82a8f9d7ef6b9
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/io/mod.rs:1672:15
   6:     0x7f99a8845eb3 - std::sys_common::backtrace::_print::h4f98a8eb4e042425
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f99a8845eb3 - std::sys_common::backtrace::print::hf0426c95c343200a
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f99a8845eb3 - std::panicking::default_hook::{{closure}}::h6bf74a4fe42587c3
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/panicking.rs:295:22
   9:     0x7f99a8845b9f - std::panicking::default_hook::hc15c16d507f2ded6
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/panicking.rs:314:9
  10:     0x7f99ab0824b4 - <rustc_driver[7acec8c68a8eef9a]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[ac7fceaa27925cdc]::ops::function::FnOnce<(&core[ac7fceaa27925cdc]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f99a88466ed - std::panicking::rust_panic_with_hook::h27da5cd3408c9bf7
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/panicking.rs:702:17
  12:     0x7f99a8846547 - std::panicking::begin_panic_handler::{{closure}}::hadce4d88925fe2f3
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/panicking.rs:588:13
  13:     0x7f99a88436fc - std::sys_common::backtrace::__rust_end_short_backtrace::hd9a07b2c0f1ddc97
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f99a8846262 - rust_begin_unwind
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/panicking.rs:584:5
  15:     0x7f99a889ada3 - core::panicking::panic_fmt::h3cbd12684227df45
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/core/src/panicking.rs:142:14
  16:     0x7f99a889af8b - core::panicking::assert_failed_inner::h3cee74b612fb1091
  17:     0x7f99ab13e76c - core[ac7fceaa27925cdc]::panicking::assert_failed::<u128, u128>
  18:     0x7f99a9cfc484 - <&mut rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::enums::native::build_enum_variant_part_di_node::{closure#1}::{closure#0} as core[ac7fceaa27925cdc]::ops::function::FnOnce<(&rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::enums::native::VariantMemberInfo,)>>::call_once
  19:     0x7f99aa075c2e - rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::type_map::build_type_with_children::<rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::enums::native::build_enum_variant_part_di_node::{closure#1}, for<'a, 'b, 'c> fn(&'a rustc_codegen_llvm[4e68abd28577a012]::context::CodegenCx<'b, 'c>) -> smallvec[8653081408a2c545]::SmallVec<[&'b rustc_codegen_llvm[4e68abd28577a012]::llvm_::ffi::Metadata; 16usize]>>
  20:     0x7f99aa0746ae - rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::enums::native::build_enum_variant_part_di_node
  21:     0x7f99aa07310d - rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::type_map::build_type_with_children::<rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::enums::native::build_enum_type_di_node::{closure#0}, for<'a, 'b, 'c> fn(&'a rustc_codegen_llvm[4e68abd28577a012]::context::CodegenCx<'b, 'c>) -> smallvec[8653081408a2c545]::SmallVec<[&'b rustc_codegen_llvm[4e68abd28577a012]::llvm_::ffi::Metadata; 16usize]>>
  22:     0x7f99aa069bf5 - rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::enums::native::build_enum_type_di_node
  23:     0x7f99aa069592 - rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::enums::build_enum_type_di_node
  24:     0x7f99aa061b57 - rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::type_di_node
  25:     0x7f99aa06ab1f - rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::build_pointer_or_reference_di_node
  26:     0x7f99aa0618d8 - rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::type_di_node
  27:     0x7f99aa06ab1f - rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::build_pointer_or_reference_di_node
  28:     0x7f99aa0618d8 - rustc_codegen_llvm[4e68abd28577a012]::debuginfo::metadata::type_di_node
  29:     0x7f99aa05e210 - <rustc_codegen_llvm[4e68abd28577a012]::context::CodegenCx as rustc_codegen_ssa[d4de2c01e209297b]::traits::debuginfo::DebugInfoMethods>::dbg_scope_fn
  30:     0x7f99a9f170d2 - rustc_codegen_ssa[d4de2c01e209297b]::mir::codegen_mir::<rustc_codegen_llvm[4e68abd28577a012]::builder::Builder>
  31:     0x7f99aab49b1f - rustc_codegen_llvm[4e68abd28577a012]::base::compile_codegen_unit::module_codegen
  32:     0x7f99aacaa6b9 - <rustc_query_system[7f2bd2325849f5fe]::dep_graph::graph::DepGraph<rustc_middle[6fd92c69c2ccf6e9]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[6fd92c69c2ccf6e9]::ty::context::TyCtxt, rustc_span[cdda92332e8855b3]::symbol::Symbol, rustc_codegen_ssa[d4de2c01e209297b]::ModuleCodegen<rustc_codegen_llvm[4e68abd28577a012]::ModuleLlvm>>
  33:     0x7f99aaca9389 - rustc_codegen_llvm[4e68abd28577a012]::base::compile_codegen_unit
  34:     0x7f99aaca7a93 - rustc_codegen_ssa[d4de2c01e209297b]::base::codegen_crate::<rustc_codegen_llvm[4e68abd28577a012]::LlvmCodegenBackend>
  35:     0x7f99aaca726e - <rustc_codegen_llvm[4e68abd28577a012]::LlvmCodegenBackend as rustc_codegen_ssa[d4de2c01e209297b]::traits::backend::CodegenBackend>::codegen_crate
  36:     0x7f99aa8b111c - <rustc_session[aebec4435f5e3031]::session::Session>::time::<alloc[30af941a830e574d]::boxed::Box<dyn core[ac7fceaa27925cdc]::any::Any>, rustc_interface[6235f317eb58e298]::passes::start_codegen::{closure#0}>
  37:     0x7f99aa8b0a53 - <rustc_interface[6235f317eb58e298]::passes::QueryContext>::enter::<<rustc_interface[6235f317eb58e298]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[ac7fceaa27925cdc]::result::Result<alloc[30af941a830e574d]::boxed::Box<dyn core[ac7fceaa27925cdc]::any::Any>, rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>>
  38:     0x7f99aa8a8943 - <rustc_interface[6235f317eb58e298]::queries::Queries>::ongoing_codegen
  39:     0x7f99aa8a79e1 - <rustc_interface[6235f317eb58e298]::interface::Compiler>::enter::<rustc_driver[7acec8c68a8eef9a]::run_compiler::{closure#1}::{closure#2}, core[ac7fceaa27925cdc]::result::Result<core[ac7fceaa27925cdc]::option::Option<rustc_interface[6235f317eb58e298]::queries::Linker>, rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>>
  40:     0x7f99aa8a349c - rustc_span[cdda92332e8855b3]::with_source_map::<core[ac7fceaa27925cdc]::result::Result<(), rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>, rustc_interface[6235f317eb58e298]::interface::create_compiler_and_run<core[ac7fceaa27925cdc]::result::Result<(), rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>, rustc_driver[7acec8c68a8eef9a]::run_compiler::{closure#1}>::{closure#1}>
  41:     0x7f99aa8a2e82 - rustc_interface[6235f317eb58e298]::interface::create_compiler_and_run::<core[ac7fceaa27925cdc]::result::Result<(), rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>, rustc_driver[7acec8c68a8eef9a]::run_compiler::{closure#1}>
  42:     0x7f99aa8a1a21 - <scoped_tls[b7a4a561eb1847ab]::ScopedKey<rustc_span[cdda92332e8855b3]::SessionGlobals>>::set::<rustc_interface[6235f317eb58e298]::interface::run_compiler<core[ac7fceaa27925cdc]::result::Result<(), rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>, rustc_driver[7acec8c68a8eef9a]::run_compiler::{closure#1}>::{closure#0}, core[ac7fceaa27925cdc]::result::Result<(), rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>>
  43:     0x7f99aa8a170f - std[bec725f6f91fed58]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6235f317eb58e298]::util::run_in_thread_pool_with_globals<rustc_interface[6235f317eb58e298]::interface::run_compiler<core[ac7fceaa27925cdc]::result::Result<(), rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>, rustc_driver[7acec8c68a8eef9a]::run_compiler::{closure#1}>::{closure#0}, core[ac7fceaa27925cdc]::result::Result<(), rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>>::{closure#0}, core[ac7fceaa27925cdc]::result::Result<(), rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>>
  44:     0x7f99aaeacc79 - <<std[bec725f6f91fed58]::thread::Builder>::spawn_unchecked_<rustc_interface[6235f317eb58e298]::util::run_in_thread_pool_with_globals<rustc_interface[6235f317eb58e298]::interface::run_compiler<core[ac7fceaa27925cdc]::result::Result<(), rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>, rustc_driver[7acec8c68a8eef9a]::run_compiler::{closure#1}>::{closure#0}, core[ac7fceaa27925cdc]::result::Result<(), rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>>::{closure#0}, core[ac7fceaa27925cdc]::result::Result<(), rustc_errors[3c24514f9e91e53d]::ErrorGuaranteed>>::{closure#1} as core[ac7fceaa27925cdc]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7f99a88504e3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he6e458d19cccc147
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/alloc/src/boxed.rs:1935:9
  46:     0x7f99a88504e3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2cf7ea75118e315a
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/alloc/src/boxed.rs:1935:9
  47:     0x7f99a88504e3 - std::sys::unix::thread::Thread::new::thread_start::h6f522cb5deb7ed15
                               at /rustc/3694b7d307b7516757651952b30bb97b6ba5c049/library/std/src/sys/unix/thread.rs:108:17
  48:     0x7f99a85b078d - <unknown>
  49:     0x7f99a86318e4 - clone
  50:                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.65.0-nightly (3694b7d30 2022-08-15) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2

query stack during panic:
end of query stack
warning: 1 warning emitted

@matthiaskrgr matthiaskrgr added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) 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. labels Aug 16, 2022
@scottmcm
Copy link
Member

Note that the repr(i128) tracking issue mentions this problem: #56071

@JohnTitor
Copy link
Member

Triage: Fixed on the latest nightly, @rustbot labels: +E-needs-test

@rustbot rustbot added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jun 24, 2023
@ldm0
Copy link
Contributor

ldm0 commented Jun 24, 2023

Related: #112474

@JohnTitor
Copy link
Member

Thanks! Seems we already have a regression test for this case, closing.

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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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

No branches or pull requests

6 participants