rust-lang / rust-lang/rustc_codegen_cranelift
ICE with [linkage] attr: thread 'rustc' panicked at 'Common', src/linkage.rs:29:18
Open
Nobody has claimed this yet.
C-enhancement
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 157
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 3
Description
code from rustc src/test/ui/issues/issue-33992.rs
// run-pass
// ignore-windows
// ignore-macos
// ignore-emscripten common linkage not implemented right now
#![feature(linkage)]
#[linkage = "common"]
pub static mut TEST1: u32 = 0u32;
#[linkage = "external"]
pub static TEST2: bool = true;
#[linkage = "internal"]
pub static TEST3: bool = true;
#[linkage = "linkonce"]
pub static TEST4: bool = true;
#[linkage = "linkonce_odr"]
pub static TEST5: bool = true;
#[linkage = "private"]
pub static TEST6: bool = true;
#[linkage = "weak"]
pub static TEST7: bool = true;
#[linkage = "weak_odr"]
pub static TEST8: bool = true;
fn main() {}
thread 'rustc' panicked at 'Common', src/linkage.rs:29:18
stack backtrace:
0: 0x7f46914a1b20 - std::backtrace_rs::backtrace::libunwind::trace::h419808c895a1be3b
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
1: 0x7f46914a1b20 - std::backtrace_rs::backtrace::trace_unsynchronized::h4cd640051eb1546f
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f46914a1b20 - std::sys_common::backtrace::_print_fmt::h6a643b487717d871
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/sys_common/backtrace.rs:66:5
3: 0x7f46914a1b20 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h84bab1c2a632e967
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/sys_common/backtrace.rs:45:22
4: 0x7f46914fa85c - core::fmt::write::h41252a77742ac576
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/core/src/fmt/mod.rs:1198:17
5: 0x7f46914933c5 - std::io::Write::write_fmt::h68f35cff36a534dd
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/io/mod.rs:1672:15
6: 0x7f46914a4711 - std::sys_common::backtrace::_print::h82f0b1ac2501b6af
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/sys_common/backtrace.rs:48:5
7: 0x7f46914a4711 - std::sys_common::backtrace::print::h3dc7f0e84685b9ba
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/sys_common/backtrace.rs:35:9
8: 0x7f46914a4711 - std::panicking::default_hook::{{closure}}::h6ace3fe16ec6f7aa
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/panicking.rs:295:22
9: 0x7f46914a43e3 - std::panicking::default_hook::h77c1c7afb621e87c
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/panicking.rs:314:9
10: 0x7f4691d3f824 - rustc_driver[e83335c4a38137f8]::DEFAULT_HOOK::{closure#0}::{closure#0}
11: 0x7f46914a4ee6 - std::panicking::rust_panic_with_hook::h4cc32db16e14054a
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/panicking.rs:702:17
12: 0x7f46914a4d37 - std::panicking::begin_panic_handler::{{closure}}::h402861fe76edfc4d
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/panicking.rs:588:13
13: 0x7f46914a1ff4 - std::sys_common::backtrace::__rust_end_short_backtrace::he555a3759268da10
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/sys_common/backtrace.rs:138:18
14: 0x7f46914a4a62 - rust_begin_unwind
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/panicking.rs:584:5
15: 0x7f46914698e3 - core::panicking::panic_fmt::hd3841d7ec8a5a967
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/core/src/panicking.rs:142:14
16: 0x7f468a2fe7b2 - rustc_codegen_cranelift::linkage::get_static_linkage::haeec16d987922bc0
17: 0x7f468a2d074c - rustc_codegen_cranelift::constant::data_id_for_static::hfd387dd9f5b18aae
18: 0x7f468a2cd351 - rustc_codegen_cranelift::constant::ConstantCx::finalize::h228dd8a166290d8c
19: 0x7f468a26424b - rustc_codegen_cranelift::driver::aot::module_codegen::h2827a110f59deab8
20: 0x7f468a2eb1be - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h68aa13779d3bec18
21: 0x7f468a2da8fa - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::h355dce7525158f4e
22: 0x7f468a30d47e - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::h381e907e74a9d74a
23: 0x7f468a2c2fa2 - rustc_session::utils::<impl rustc_session::session::Session>::time::h13abb3ffbb1cca82
24: 0x7f468a2fbf64 - rustc_codegen_cranelift::driver::time::h7de8a4d08c3be2ab
25: 0x7f468a266415 - rustc_codegen_cranelift::driver::aot::run_aot::h246f8b5585a00b3a
26: 0x7f468a2b20d9 - <rustc_codegen_cranelift::CraneliftCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h43a3212ba3170bbb
27: 0x7f4693ed5727 - <rustc_session[16e8265f3bee680e]::session::Session>::time::<alloc[aede580a0175a08c]::boxed::Box<dyn core[303bee78761e0753]::any::Any>, rustc_interface[edbb2596f0660065]::passes::start_codegen::{closure#0}>
28: 0x7f4693ec2d40 - <rustc_interface[edbb2596f0660065]::passes::QueryContext>::enter::<<rustc_interface[edbb2596f0660065]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[303bee78761e0753]::result::Result<alloc[aede580a0175a08c]::boxed::Box<dyn core[303bee78761e0753]::any::Any>, rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>>
29: 0x7f4693ecca23 - <rustc_interface[edbb2596f0660065]::queries::Queries>::ongoing_codegen
30: 0x7f4693e8e8e1 - <rustc_interface[edbb2596f0660065]::interface::Compiler>::enter::<rustc_driver[e83335c4a38137f8]::run_compiler::{closure#1}::{closure#2}, core[303bee78761e0753]::result::Result<core[303bee78761e0753]::option::Option<rustc_interface[edbb2596f0660065]::queries::Linker>, rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>>
31: 0x7f4693e8aab0 - rustc_span[550c183cd1c0caaa]::with_source_map::<core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>, rustc_interface[edbb2596f0660065]::interface::create_compiler_and_run<core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>, rustc_driver[e83335c4a38137f8]::run_compiler::{closure#1}>::{closure#1}>
32: 0x7f4693ea50f2 - rustc_interface[edbb2596f0660065]::interface::create_compiler_and_run::<core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>, rustc_driver[e83335c4a38137f8]::run_compiler::{closure#1}>
33: 0x7f4693e8a2b2 - <scoped_tls[c1a1588d7c68db11]::ScopedKey<rustc_span[550c183cd1c0caaa]::SessionGlobals>>::set::<rustc_interface[edbb2596f0660065]::interface::run_compiler<core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>, rustc_driver[e83335c4a38137f8]::run_compiler::{closure#1}>::{closure#0}, core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>>
34: 0x7f4693e8cfcf - std[a38b499b13c80ab0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[edbb2596f0660065]::util::run_in_thread_pool_with_globals<rustc_interface[edbb2596f0660065]::interface::run_compiler<core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>, rustc_driver[e83335c4a38137f8]::run_compiler::{closure#1}>::{closure#0}, core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>>::{closure#0}, core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>>
35: 0x7f4693ea5539 - <<std[a38b499b13c80ab0]::thread::Builder>::spawn_unchecked_<rustc_interface[edbb2596f0660065]::util::run_in_thread_pool_with_globals<rustc_interface[edbb2596f0660065]::interface::run_compiler<core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>, rustc_driver[e83335c4a38137f8]::run_compiler::{closure#1}>::{closure#0}, core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>>::{closure#0}, core[303bee78761e0753]::result::Result<(), rustc_errors[cf96977925b9f0c]::ErrorGuaranteed>>::{closure#1} as core[303bee78761e0753]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
36: 0x7f46914ae843 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6cafef397152c3f0
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/alloc/src/boxed.rs:1951:9
37: 0x7f46914ae843 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0308246411b63a3b
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/alloc/src/boxed.rs:1951:9
38: 0x7f46914ae843 - std::sys::unix::thread::Thread::new::thread_start::hd2e6d604897dcfa7
at /rustc/f2d93935ffba3ab9d7ccb5300771a2d29b4c8bf3/library/std/src/sys/unix/thread.rs:108:17
39: 0x7f469128054d - <unknown>
40: 0x7f4691305874 - clone
41: 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.64.0-nightly (f2d93935f 2022-07-02) running on x86_64-unknown-linux-gnu
note: compiler flags: -C panic=abort -Z panic-abort-tests -Z codegen-backend=/home/matthias/vcs/github/rustc_codegen_cranelift/build/lib/librustc_codegen_cranelift.so
query stack during panic:
end of query stack
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the ICE with src/test/ui/issues/issue-33992.rs using the codegen backend described in the report. Inspect src/linkage.rs, especially get_static_linkage at line 29, and trace how the common linkage reaches that panic. Done means the test no longer causes an internal compiler error while preserving the other linkage cases shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100