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: instrument-coverage on generator-storage-dead-unwind.rs #85213

Closed
matthiaskrgr opened this issue May 12, 2021 · 6 comments
Closed

ICE: instrument-coverage on generator-storage-dead-unwind.rs #85213

matthiaskrgr opened this issue May 12, 2021 · 6 comments
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

@matthiaskrgr
Copy link
Member

Code

code from ./src/test/mir-opt/generator-storage-dead-unwind.rs

// ignore-wasm32-bare compiled with panic=abort by default

// Test that we generate StorageDead on unwind paths for generators.
//
// Basic block and local names can safely change, but the StorageDead statements
// should not go away.

#![feature(generators, generator_trait)]

struct Foo(i32);

impl Drop for Foo {
    fn drop(&mut self) {}
}

struct Bar(i32);

fn take<T>(_x: T) {}

// EMIT_MIR generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
fn main() {
    let _gen = || {
        let a = Foo(5);
        let b = Bar(6);
        yield;
        take(a);
        take(b);
    };
}

Meta

rustc --version --verbose:

rustc 1.54.0-nightly (79e50bf77 2021-05-10)
binary: rustc
commit-hash: 79e50bf77928f374921a6bcafee3fcff1915f062
commit-date: 2021-05-10
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1

Error output

thread 'rustc' panicked at 'No counters provided the source_hash for used function: Instance { def: DropGlue(DefId(2:2347 ~ core[ec89]::ptr::drop_in_place), Some([generator@./src/test/mir-opt/generator-storage-dead-unwind.rs:22:16: 28:6 {Foo, Bar, ()}])), substs: [[generator@./src/test/mir-opt/generator-storage-dead-unwind.rs:22:16: 28:6 {Foo, Bar, ()}]] }', compiler/rustc_codegen_ssa/src/coverageinfo/map.rs:147:9
note: run with `RUST_BACKTRACE=1` environment variable to display a 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.54.0-nightly (79e50bf77 2021-05-10) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z instrument-coverage

query stack during panic:
end of query stack

RUST_BACKTRACE=full rustc ./src/test/mir-opt/generator-storage-dead-unwind.rs -Zinstrument-coverage

Backtrace

thread 'rustc' panicked at 'No counters provided the source_hash for used function: Instance { def: DropGlue(DefId(2:2347 ~ core[ec89]::ptr::drop_in_place), Some([generator@./src/test/mir-opt/generator-storage-dead-unwind.rs:22:16: 28:6 {Foo, Bar, ()}])), substs: [[generator@./src/test/mir-opt/generator-storage-dead-unwind.rs:22:16: 28:6 {Foo, Bar, ()}]] }', compiler/rustc_codegen_ssa/src/coverageinfo/map.rs:147:9
stack backtrace:
   0:     0x7f6b212fe2f0 - std::backtrace_rs::backtrace::libunwind::trace::hdcf4f90f85129e83
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f6b212fe2f0 - std::backtrace_rs::backtrace::trace_unsynchronized::h2669e30cb82f6732
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f6b212fe2f0 - std::sys_common::backtrace::_print_fmt::hfbda19e17f6db318
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f6b212fe2f0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1a8751bf59281272
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f6b2136c6ef - core::fmt::write::h7aa6cd0067dca82a
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/core/src/fmt/mod.rs:1094:17
   5:     0x7f6b212efc05 - std::io::Write::write_fmt::hd7dd3a1df9b6befb
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/io/mod.rs:1584:15
   6:     0x7f6b2130201b - std::sys_common::backtrace::_print::h551e9ec8a9fa8106
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f6b2130201b - std::sys_common::backtrace::print::ha4b1c5e95fa040b3
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f6b2130201b - std::panicking::default_hook::{{closure}}::h0b34c9ab7fb9f857
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/panicking.rs:208:50
   9:     0x7f6b21301afd - std::panicking::default_hook::h3067e8318decd17a
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/panicking.rs:225:9
  10:     0x7f6b21ac7aed - rustc_driver::report_ice::hfc42315e68be674c
  11:     0x7f6b21302730 - std::panicking::rust_panic_with_hook::h81b8facc50f34daa
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/panicking.rs:595:17
  12:     0x7f6b21302307 - std::panicking::begin_panic_handler::{{closure}}::ha376ab85d95a000e
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/panicking.rs:497:13
  13:     0x7f6b212fe7ac - std::sys_common::backtrace::__rust_end_short_backtrace::h6795c8afdd1a77e6
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f6b21302269 - rust_begin_unwind
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/panicking.rs:493:5
  15:     0x7f6b212cb23b - std::panicking::begin_panic_fmt::hf43a0025042538e2
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/panicking.rs:435:5
  16:     0x7f6b22538450 - rustc_codegen_ssa::coverageinfo::map::FunctionCoverage::get_expressions_and_counter_regions::h2133bd5453e9e69b
  17:     0x7f6b21beded5 - rustc_codegen_llvm::coverageinfo::mapgen::finalize::hc772659458050421
  18:     0x7f6b22bb92cf - rustc_codegen_llvm::base::compile_codegen_unit::module_codegen::h4d829582356e3b8f
  19:     0x7f6b23649dba - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h63e00bf93ea2f024
  20:     0x7f6b23666d32 - rustc_codegen_llvm::base::compile_codegen_unit::ha9dfc44b3624cfa3
  21:     0x7f6b23646077 - rustc_codegen_ssa::base::codegen_crate::h66789e9899448d40
  22:     0x7f6b23644b86 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h0ee8708217e97614
  23:     0x7f6b235cd2cb - rustc_interface::passes::QueryContext::enter::h6f79efed27e7b642
  24:     0x7f6b235d6db6 - rustc_interface::queries::Queries::ongoing_codegen::hfde280ae33444077
  25:     0x7f6b23594b93 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h338ef067f4e62908
  26:     0x7f6b23593b64 - rustc_span::with_source_map::ha9bd2637219a67ee
  27:     0x7f6b23595b21 - rustc_interface::interface::create_compiler_and_run::hdbdae17b1d4b741f
  28:     0x7f6b235af3e8 - scoped_tls::ScopedKey<T>::set::h8b11ff7379d3a1e7
  29:     0x7f6b235af8eb - std::sys_common::backtrace::__rust_begin_short_backtrace::heda65a548bd4e2a1
  30:     0x7f6b235b3225 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h05ddc76e238daac0
  31:     0x7f6b2130e587 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3aa31cb6360b59d9
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/alloc/src/boxed.rs:1575:9
  32:     0x7f6b2130e587 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7719d3c7c5841461
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/alloc/src/boxed.rs:1575:9
  33:     0x7f6b2130e587 - std::sys::unix::thread::Thread::new::thread_start::hfbe13ead469fd0bc
                               at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/sys/unix/thread.rs:71:17
  34:     0x7f6b21220299 - start_thread
  35:     0x7f6b21135053 - clone
  36:                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.54.0-nightly (79e50bf77 2021-05-10) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z instrument-coverage

query stack during panic:
end of query stack

@matthiaskrgr matthiaskrgr added 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. labels May 12, 2021
@philippgl
Copy link

philippgl commented May 12, 2021

Hi, I also ran into this bug.

It first occurs with the nightly-2021-05-08-x86_64-unknown-linux-gnu toolchain. nightly-2021-05-07-x86_64-unknown-linux-gnu still works. I am unsure how to specify the version number correctly, but this is what rustup tells me.

This also affects the tokio-util package.

I think, this is a duplicate of #85128

If someone wants to do the git bisect:
good: 676ee14, bad: 770792f

@matthiaskrgr
Copy link
Member Author

Reduced:

#![feature(generators)]

struct Foo();

impl Drop for Foo {
    fn drop(&mut self) {}
}

fn take<T>(_x: T) {}

fn main() {
    let _gen = || {
        let a = Foo();
        yield;
        take(a);
    };
} 

cargo bisect says this ICEs since e5f83d2 / #84797 cc @richkadel

@richkadel
Copy link
Contributor

This is a duplicate of known issue reported here: #85081 and the change that caused it was reverted. The next nightly should resolve the problem.

@richkadel
Copy link
Contributor

Should be fixed via the revert in PR #85196

@richkadel
Copy link
Contributor

@matthiaskrgr can you close this issue unless you can still reproduce it? (Should be fixed.)

@matthiaskrgr
Copy link
Member Author

Confirmed, thanks! :)

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

No branches or pull requests

3 participants