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 compiling alloc-tls #70673

Closed
joshlf opened this issue Apr 1, 2020 · 2 comments · Fixed by #70720
Closed

ICE compiling alloc-tls #70673

joshlf opened this issue Apr 1, 2020 · 2 comments · Fixed by #70720
Labels
A-codegen Area: Code generation A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-macos Operating system: macOS T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@joshlf
Copy link
Contributor

joshlf commented Apr 1, 2020

When running cargo test --no-run on this commit of the alloc-tls crate, rustc panics:

$ RUST_BACKTRACE=1 cargo test --no-run
   Compiling alloc-tls v0.1.0 (<redacted>/allocators-rs/alloc-tls)
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `2`,
 right: `0`', src/librustc_codegen_llvm/consts.rs:438:21
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: rustc_driver::report_ice
   6: std::panicking::rust_panic_with_hook
   7: rust_begin_unwind
   8: std::panicking::begin_panic_fmt
   9: rustc_codegen_llvm::consts::<impl rustc_codegen_ssa::traits::statics::StaticMethods for rustc_codegen_llvm::context::CodegenCx>::codegen_static
  10: <rustc::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define
  11: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
  12: rustc::dep_graph::graph::DepGraph::with_task
  13: rustc_codegen_llvm::base::compile_codegen_unit
  14: rustc_codegen_ssa::base::codegen_crate
  15: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  16: rustc_session::utils::<impl rustc_session::session::Session>::time
  17: rustc_interface::passes::start_codegen
  18: rustc::ty::context::tls::enter_global
  19: rustc_interface::queries::Queries::ongoing_codegen
  20: rustc_interface::interface::run_compiler_in_existing_thread_pool
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.0-nightly (f509b26a7 2020-03-18) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental

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

query stack during panic:
end of query stack

Version

Platform: macos

$ rustc --version
rustc 1.44.0-nightly (f509b26a7 2020-03-18)
@jonas-schievink jonas-schievink added A-codegen Area: Code generation A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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 Apr 1, 2020
@sollyucko
Copy link
Contributor

FYI, this appears to be a macOS-specific bug: https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_llvm/consts.rs#L410-L440.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 3, 2020

Minimal repro:

#![feature(thread_local)]

#[thread_local]
static A: &u8 = &42;

fn main() {
    dbg!(*A);
}

@oli-obk oli-obk removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Apr 3, 2020
ecstatic-morse pushed a commit to ecstatic-morse/rust that referenced this issue Apr 3, 2020
@bors bors closed this as completed in 80690b0 Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-macos Operating system: macOS 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.

4 participants