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

Disk cache ICE with big array #76037

Closed
Spferical opened this issue Aug 28, 2020 · 3 comments · Fixed by #113562
Closed

Disk cache ICE with big array #76037

Spferical opened this issue Aug 28, 2020 · 3 comments · Fixed by #113562
Assignees
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-incr-comp Working group: Incremental compilation

Comments

@Spferical
Copy link

Spferical commented Aug 28, 2020

Code

fn main() {
    println!("{}", [37; 1073741825].len());
}

Meta

rustc --version --verbose:

rustc 1.48.0-nightly (397b390cc 2020-08-27)
binary: rustc
commit-hash: 397b390cc76ba1d98f80b2a24a371f708dcc9169
commit-date: 2020-08-27
host: x86_64-unknown-linux-gnu
release: 1.48.0-nightly
LLVM version: 11.0

I see similar behavior in stable 1.46.0:

rustc 1.46.0 (04488afe3 2020-08-24)
binary: rustc
commit-hash: 04488afe34512aa4c33566eb16d8c912a3ae04f9
commit-date: 2020-08-24
host: x86_64-unknown-linux-gnu
release: 1.46.0
LLVM version: 10.0

The example always succeeds to compile the first time, but uses a large amount of time and memory. time cargo build:

real	1:44.44
user	1:30.93
sys	4.967
maxmem	9673 MB
faults	0

Upon incremental re-compilation, I almost always see one of the following errors.

I saw other open issues with a similar error message as the 1.46.0 output below, but in this one the error is affected by the value the array was filled with.

Error output

cargo clean && cargo build && touch src/main.rs && cargo build:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/librustc_middle/ty/query/on_disk_cache.rs:658:48
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.48.0-nightly (397b390cc 2020-08-27) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

error: could not compile `ice3`.

To learn more, run the command again with --verbose.

Running sometimes yields a different yet similar error:

error: internal compiler error: src/librustc_middle/ty/query/on_disk_cache.rs:422:23: could not decode cached query result: invalid enum variant tag while decoding `Transparency`, expected 0..3

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:918:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.48.0-nightly (397b390cc 2020-08-27) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

error: aborting due to previous error

error: could not compile `ice3`.

To learn more, run the command again with --verbose.

On 1.46.0:

thread 'rustc' panicked at 'index out of bounds: the len is 4 but the index is 37', src/librustc_middle/mir/interpret/mod.rs:272:35
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.46.0 (04488afe3 2020-08-24) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

error: could not compile `ice3`.

To learn more, run the command again with --verbose.
Backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/librustc_middle/ty/query/on_disk_cache.rs:658:48
stack backtrace:
   0: rust_begin_unwind
             at /rustc/397b390cc76ba1d98f80b2a24a371f708dcc9169/library/std/src/panicking.rs:475
   1: core::panicking::panic_fmt
             at /rustc/397b390cc76ba1d98f80b2a24a371f708dcc9169/library/core/src/panicking.rs:85
   2: core::panicking::panic
             at /rustc/397b390cc76ba1d98f80b2a24a371f708dcc9169/library/core/src/panicking.rs:50
   3: rustc_middle::ty::query::on_disk_cache::<impl rustc_serialize::serialize::Decodable<rustc_middle::ty::query::on_disk_cache::CacheDecoder> for rustc_span::hygiene::SyntaxContext>::decode
   4: rustc_span::hygiene::_DERIVE_rustc_serialize_Decodable_D_FOR_SyntaxContextData::<impl rustc_serialize::serialize::Decodable<__D> for rustc_span::hygiene::SyntaxContextData>::decode
   5: <rustc_middle::ty::query::on_disk_cache::CacheDecoder as rustc_middle::ty::codec::TyDecoder>::with_position
   6: rustc_middle::ty::query::on_disk_cache::<impl rustc_serialize::serialize::Decodable<rustc_middle::ty::query::on_disk_cache::CacheDecoder> for rustc_span::hygiene::SyntaxContext>::decode
   7: rustc_middle::ty::query::on_disk_cache::<impl rustc_serialize::serialize::Decodable<rustc_middle::ty::query::on_disk_cache::CacheDecoder> for rustc_span::span_encoding::Span>::decode
   8: rustc_middle::mir::_DERIVE_rustc_serialize_Decodable_D_FOR_SourceInfo::<impl rustc_serialize::serialize::Decodable<__D> for rustc_middle::mir::SourceInfo>::decode
   9: rustc_middle::mir::_DERIVE_rustc_serialize_Decodable_D_FOR_Statement::<impl rustc_serialize::serialize::Decodable<__D> for rustc_middle::mir::Statement>::decode
  10: rustc_serialize::serialize::Decoder::read_seq
  11: rustc_middle::mir::_DERIVE_rustc_serialize_Decodable_D_FOR_BasicBlockData::<impl rustc_serialize::serialize::Decodable<__D> for rustc_middle::mir::BasicBlockData>::decode
  12: rustc_serialize::serialize::Decoder::read_seq
  13: rustc_middle::mir::_DERIVE_rustc_serialize_Decodable_D_FOR_Body::<impl rustc_serialize::serialize::Decodable<__D> for rustc_middle::mir::Body>::decode
  14: rustc_middle::ty::query::on_disk_cache::OnDiskCache::try_load_query_result
  15: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
  16: rustc_query_system::query::plumbing::get_query_impl
  17: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::instance_mir
  18: rustc_mir::monomorphize::collector::collect_neighbours
  19: rustc_mir::monomorphize::collector::collect_items_rec
  20: rustc_session::utils::<impl rustc_session::session::Session>::time
  21: rustc_mir::monomorphize::collector::collect_crate_mono_items
  22: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  23: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_and_partition_mono_items>::compute
  24: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  25: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  26: rustc_data_structures::stack::ensure_sufficient_stack
  27: rustc_query_system::query::plumbing::get_query_impl
  28: rustc_codegen_ssa::base::codegen_crate
  29: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  30: rustc_interface::passes::QueryContext::enter
  31: rustc_interface::queries::Queries::ongoing_codegen
  32: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  33: rustc_span::with_source_map
  34: rustc_interface::interface::create_compiler_and_run
  35: scoped_tls::ScopedKey<T>::set
error: internal compiler error: src/librustc_middle/ty/query/on_disk_cache.rs:422:23: could not decode cached query result: invalid enum variant tag while decoding `Transparency`, expected 0..3

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:918:9
stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_errors::HandlerInner::bug
   2: rustc_errors::Handler::bug
   3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
   4: rustc_middle::ty::context::tls::with_opt::{{closure}}
   5: rustc_middle::ty::context::tls::with_opt
   6: rustc_middle::util::bug::opt_span_bug_fmt
   7: rustc_middle::util::bug::bug_fmt
   8: rustc_middle::ty::query::on_disk_cache::OnDiskCache::try_load_query_result
   9: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
  10: rustc_query_system::query::plumbing::get_query_impl
  11: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::instance_mir
  12: rustc_mir::monomorphize::collector::collect_neighbours
  13: rustc_mir::monomorphize::collector::collect_items_rec
  14: rustc_session::utils::<impl rustc_session::session::Session>::time
  15: rustc_mir::monomorphize::collector::collect_crate_mono_items
  16: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  17: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_and_partition_mono_items>::compute
  18: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  19: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  20: rustc_data_structures::stack::ensure_sufficient_stack
  21: rustc_query_system::query::plumbing::get_query_impl
  22: rustc_codegen_ssa::base::codegen_crate
  23: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  24: rustc_interface::passes::QueryContext::enter
  25: rustc_interface::queries::Queries::ongoing_codegen
  26: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  27: rustc_span::with_source_map
  28: rustc_interface::interface::create_compiler_and_run
  29: scoped_tls::ScopedKey<T>::set

On 1.46.0:

thread 'rustc' panicked at 'index out of bounds: the len is 4 but the index is 37', src/librustc_middle/mir/interpret/mod.rs:272:35
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:217
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:530
  12: rust_begin_unwind
             at src/libstd/panicking.rs:437
  13: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  14: core::panicking::panic_bounds_check
             at src/libcore/panicking.rs:62
  15: rustc_middle::mir::interpret::AllocDecodingSession::decode_alloc_id
  16: <(T10,T11) as rustc_serialize::serialize::Decodable>::decode
  17: rustc_serialize::serialize::Decoder::read_seq
  18: <rustc_middle::mir::interpret::allocation::Allocation<Tag,Extra> as rustc_serialize::serialize::Decodable>::decode
  19: <rustc_middle::ty::query::on_disk_cache::CacheDecoder as rustc_middle::ty::codec::TyDecoder>::with_position
  20: rustc_middle::mir::interpret::AllocDecodingSession::decode_alloc_id
  21: <(T10,T11) as rustc_serialize::serialize::Decodable>::decode
  22: rustc_serialize::serialize::Decoder::read_seq
  23: <rustc_middle::mir::interpret::allocation::Allocation<Tag,Extra> as rustc_serialize::serialize::Decodable>::decode
  24: <rustc_middle::mir::interpret::value::ConstValue as rustc_serialize::serialize::Decodable>::decode
  25: <core::result::Result<T1,T2> as rustc_serialize::serialize::Decodable>::decode
  26: rustc_middle::ty::query::on_disk_cache::OnDiskCache::try_load_query_result
  27: rustc_middle::query::<impl rustc_query_system::query::config::QueryDescription<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::const_eval_validated>::try_load_from_disk
  28: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
  29: rustc_query_system::query::plumbing::get_query_impl
  30: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
  31: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve
  32: <rustc_trait_selection::traits::query::normalize::QueryNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_const
  33: <rustc_infer::infer::at::At as rustc_trait_selection::traits::query::normalize::AtExt>::normalize
  34: rustc_infer::infer::InferCtxtBuilder::enter
  35: rustc_traits::normalize_erasing_regions::normalize_generic_arg_after_erasing_regions
  36: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::normalize_generic_arg_after_erasing_regions>::compute
  37: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  38: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
  39: rustc_query_system::query::plumbing::get_query_impl
  40: <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle::ty::fold::TypeFolder>::fold_const
  41: rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::subst_and_normalize_erasing_regions
  42: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_const
  43: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_rvalue
  44: rustc_mir::monomorphize::collector::collect_neighbours
  45: rustc_mir::monomorphize::collector::collect_items_rec
  46: rustc_mir::monomorphize::collector::collect_crate_mono_items
  47: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  48: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_and_partition_mono_items>::compute
  49: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  50: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  51: rustc_query_system::query::plumbing::get_query_impl
  52: rustc_codegen_ssa::base::codegen_crate
  53: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  54: rustc_session::utils::<impl rustc_session::session::Session>::time
  55: rustc_interface::passes::start_codegen
  56: rustc_middle::ty::context::tls::enter_global
  57: rustc_interface::queries::Queries::ongoing_codegen
  58: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  59: rustc_span::with_source_map
  60: rustc_interface::interface::create_compiler_and_run
  61: scoped_tls::ScopedKey<T>::set

@Spferical Spferical 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 Aug 28, 2020
@wesleywiser wesleywiser added the A-incr-comp Area: Incremental compilation label Oct 18, 2020
@wesleywiser wesleywiser added the P-high High priority label Nov 3, 2020
@jackh726 jackh726 added the WG-incr-comp Working group: Incremental compilation label Feb 3, 2022
@pnkfelix
Copy link
Member

@Spferical do you know if this is still a problem for you?

@rustbot claim

@Spferical
Copy link
Author

Spferical commented Dec 16, 2022

On 1.66.0, I still get an error upon incremental recompilation with the same code:

CARGO_INCREMENTAL=1 cargo clean && cargo build && touch src/main.rs && time cargo build
<snip; compiling succeeds the first time, then yields the following the second time>
thread '<unnamed>' panicked at 'invalid enum variant tag while decoding `Mutability`, expected 0..2', /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/compiler/rustc_ast/src/ast.rs:778:41
$ rustc --version --verbose
rustc 1.66.0 (69f9c33d7 2022-12-12)
binary: rustc
commit-hash: 69f9c33d71c871fc16ac445211281c6e7a340943
commit-date: 2022-12-12
host: x86_64-unknown-linux-gnu
release: 1.66.0
LLVM version: 15.0.2
Backtrace
stack backtrace:
   0:     0x7f5dfcb6c9a0 - std::backtrace_rs::backtrace::libunwind::trace::he615646ea344481f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f5dfcb6c9a0 - std::backtrace_rs::backtrace::trace_unsynchronized::h6ea8eaac68705b9c
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f5dfcb6c9a0 - std::sys_common::backtrace::_print_fmt::h7ac486a935ce0bf7
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f5dfcb6c9a0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1b5a095d3db2e28f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f5dfcbc898e - core::fmt::write::h445545b92224a1cd
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/fmt/mod.rs:1209:17
   5:     0x7f5dfcb5cb15 - std::io::Write::write_fmt::h55a43474c6520b00
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/io/mod.rs:1682:15
   6:     0x7f5dfcb6c765 - std::sys_common::backtrace::_print::h65d20526fdb736b0
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f5dfcb6c765 - std::sys_common::backtrace::print::h6555fbe12a1cc41b
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f5dfcb6f56f - std::panicking::default_hook::{{closure}}::hbdf58083140e7ac6
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:267:22
   9:     0x7f5dfcb6f2aa - std::panicking::default_hook::haef8271c56b74d85
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:286:9
  10:     0x7f5dfcb6fd78 - std::panicking::rust_panic_with_hook::hfd45b6b6c12d9fa5
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:688:13
  11:     0x7f5dfcb6fad1 - std::panicking::begin_panic_handler::{{closure}}::hf591e8609a75bd4b
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:577:13
  12:     0x7f5dfcb6ce4c - std::sys_common::backtrace::__rust_end_short_backtrace::h81899558795e4ff7
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x7f5dfcb6f832 - rust_begin_unwind
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:575:5
  14:     0x7f5dfcbc5373 - core::panicking::panic_fmt::h4235fa9b4675b332
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:65:14
  15:     0x7f5dfe3ff094 - <rustc_middle[1bbcd7fc39987e50]::mir::interpret::allocation::ConstAllocation as rustc_serialize[a15cbf6ce3209308]::serialize::Decodable<rustc_query_impl[969f89a88b0ee9ca]::on_disk_cache::CacheDecoder>>::decode
  16:     0x7f5dfe3ff8f4 - <rustc_query_impl[969f89a88b0ee9ca]::on_disk_cache::CacheDecoder as rustc_type_ir[1fd57c2de0aaa4ec]::codec::TyDecoder>::decode_alloc_id
  17:     0x7f5dfe3ff67d - <(rustc_target[1afba1ed92600763]::abi::Size, rustc_middle[1bbcd7fc39987e50]::mir::interpret::AllocId) as rustc_serialize[a15cbf6ce3209308]::serialize::Decodable<rustc_query_impl[969f89a88b0ee9ca]::on_disk_cache::CacheDecoder>>::decode
  18:     0x7f5dfe3ff331 - <alloc[d987cf4402e5b40a]::vec::Vec<(rustc_target[1afba1ed92600763]::abi::Size, rustc_middle[1bbcd7fc39987e50]::mir::interpret::AllocId)> as rustc_serialize[a15cbf6ce3209308]::serialize::Decodable<rustc_query_impl[969f89a88b0ee9ca]::on_disk_cache::CacheDecoder>>::decode
  19:     0x7f5dfe3fee62 - <rustc_middle[1bbcd7fc39987e50]::mir::interpret::allocation::ConstAllocation as rustc_serialize[a15cbf6ce3209308]::serialize::Decodable<rustc_query_impl[969f89a88b0ee9ca]::on_disk_cache::CacheDecoder>>::decode
  20:     0x7f5dfe3ff8f4 - <rustc_query_impl[969f89a88b0ee9ca]::on_disk_cache::CacheDecoder as rustc_type_ir[1fd57c2de0aaa4ec]::codec::TyDecoder>::decode_alloc_id
  21:     0x7f5dfea42760 - <rustc_middle[1bbcd7fc39987e50]::mir::interpret::value::ConstValue as rustc_serialize[a15cbf6ce3209308]::serialize::Decodable<rustc_query_impl[969f89a88b0ee9ca]::on_disk_cache::CacheDecoder>>::decode
  22:     0x7f5dfea42441 - <core[b97a30f8df81432d]::result::Result<rustc_middle[1bbcd7fc39987e50]::mir::interpret::value::ConstValue, rustc_middle[1bbcd7fc39987e50]::mir::interpret::error::ErrorHandled> as rustc_serialize[a15cbf6ce3209308]::serialize::Decodable<rustc_query_impl[969f89a88b0ee9ca]::on_disk_cache::CacheDecoder>>::decode
  23:     0x7f5dfea42246 - <rustc_query_impl[969f89a88b0ee9ca]::on_disk_cache::OnDiskCache>::try_load_query_result::<core[b97a30f8df81432d]::result::Result<rustc_middle[1bbcd7fc39987e50]::mir::interpret::value::ConstValue, rustc_middle[1bbcd7fc39987e50]::mir::interpret::error::ErrorHandled>>
  24:     0x7f5dfea41db0 - rustc_query_impl[969f89a88b0ee9ca]::plumbing::try_load_from_disk::<core[b97a30f8df81432d]::result::Result<rustc_middle[1bbcd7fc39987e50]::mir::interpret::value::ConstValue, rustc_middle[1bbcd7fc39987e50]::mir::interpret::error::ErrorHandled>>
  25:     0x7f5dfea41b14 - rustc_query_system[330b635d327008f7]::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl[969f89a88b0ee9ca]::plumbing::QueryCtxt, rustc_middle[1bbcd7fc39987e50]::ty::ParamEnvAnd<rustc_middle[1bbcd7fc39987e50]::mir::interpret::GlobalId>, core[b97a30f8df81432d]::result::Result<rustc_middle[1bbcd7fc39987e50]::mir::interpret::value::ConstValue, rustc_middle[1bbcd7fc39987e50]::mir::interpret::error::ErrorHandled>>
  26:     0x7f5dfea3fd3f - rustc_query_system[330b635d327008f7]::query::plumbing::try_execute_query::<rustc_query_impl[969f89a88b0ee9ca]::plumbing::QueryCtxt, rustc_query_system[330b635d327008f7]::query::caches::DefaultCache<rustc_middle[1bbcd7fc39987e50]::ty::ParamEnvAnd<rustc_middle[1bbcd7fc39987e50]::mir::interpret::GlobalId>, core[b97a30f8df81432d]::result::Result<rustc_middle[1bbcd7fc39987e50]::mir::interpret::value::ConstValue, rustc_middle[1bbcd7fc39987e50]::mir::interpret::error::ErrorHandled>>>
  27:     0x7f5dff70e149 - <rustc_query_impl[969f89a88b0ee9ca]::Queries as rustc_middle[1bbcd7fc39987e50]::ty::query::QueryEngine>::eval_to_const_value_raw
  28:     0x7f5dfe8a0aa8 - <rustc_middle[1bbcd7fc39987e50]::ty::context::TyCtxt>::const_eval_resolve
  29:     0x7f5dfe8908a3 - rustc_monomorphize[a032594a6bc26d56]::collector::collect_neighbours
  30:     0x7f5dfe88a5c6 - rustc_monomorphize[a032594a6bc26d56]::collector::collect_items_rec
  31:     0x7f5dfee3941c - <rustc_session[87e5e219eb43521c]::session::Session>::time::<(), rustc_monomorphize[a032594a6bc26d56]::collector::collect_crate_mono_items::{closure#1}>
  32:     0x7f5dfee38f19 - rustc_monomorphize[a032594a6bc26d56]::collector::collect_crate_mono_items
  33:     0x7f5dfee38293 - rustc_monomorphize[a032594a6bc26d56]::partitioning::collect_and_partition_mono_items
  34:     0x7f5dff506aa7 - <rustc_query_system[330b635d327008f7]::dep_graph::graph::DepGraph<rustc_middle[1bbcd7fc39987e50]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[1bbcd7fc39987e50]::ty::context::TyCtxt, (), (&std[bbad73ae434e23e5]::collections::hash::set::HashSet<rustc_span[14998722174c1bca]::def_id::DefId, core[b97a30f8df81432d]::hash::BuildHasherDefault<rustc_hash[d2515752935e9cb7]::FxHasher>>, &[rustc_middle[1bbcd7fc39987e50]::mir::mono::CodegenUnit])>
  35:     0x7f5dff505c40 - rustc_query_system[330b635d327008f7]::query::plumbing::try_execute_query::<rustc_query_impl[969f89a88b0ee9ca]::plumbing::QueryCtxt, rustc_query_system[330b635d327008f7]::query::caches::DefaultCache<(), (&std[bbad73ae434e23e5]::collections::hash::set::HashSet<rustc_span[14998722174c1bca]::def_id::DefId, core[b97a30f8df81432d]::hash::BuildHasherDefault<rustc_hash[d2515752935e9cb7]::FxHasher>>, &[rustc_middle[1bbcd7fc39987e50]::mir::mono::CodegenUnit])>>
  36:     0x7f5dff50562b - rustc_query_system[330b635d327008f7]::query::plumbing::get_query::<rustc_query_impl[969f89a88b0ee9ca]::queries::collect_and_partition_mono_items, rustc_query_impl[969f89a88b0ee9ca]::plumbing::QueryCtxt>
  37:     0x7f5dff50556e - <rustc_query_impl[969f89a88b0ee9ca]::Queries as rustc_middle[1bbcd7fc39987e50]::ty::query::QueryEngine>::collect_and_partition_mono_items
  38:     0x7f5dff433e0a - rustc_codegen_ssa[737ec7dcbddbd4a0]::base::codegen_crate::<rustc_codegen_llvm[8e98f4afd2a755cb]::LlvmCodegenBackend>
  39:     0x7f5dff433bc2 - <rustc_codegen_llvm[8e98f4afd2a755cb]::LlvmCodegenBackend as rustc_codegen_ssa[737ec7dcbddbd4a0]::traits::backend::CodegenBackend>::codegen_crate
  40:     0x7f5dff0c8d69 - <rustc_session[87e5e219eb43521c]::session::Session>::time::<alloc[d987cf4402e5b40a]::boxed::Box<dyn core[b97a30f8df81432d]::any::Any>, rustc_interface[ee1a3f92e887e004]::passes::start_codegen::{closure#0}>
  41:     0x7f5dff0c86ba - <rustc_interface[ee1a3f92e887e004]::passes::QueryContext>::enter::<<rustc_interface[ee1a3f92e887e004]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[b97a30f8df81432d]::result::Result<alloc[d987cf4402e5b40a]::boxed::Box<dyn core[b97a30f8df81432d]::any::Any>, rustc_errors[21897ed46328f955]::ErrorGuaranteed>>
  42:     0x7f5dff087ea3 - <rustc_interface[ee1a3f92e887e004]::queries::Queries>::ongoing_codegen
  43:     0x7f5dff086fb2 - <rustc_interface[ee1a3f92e887e004]::interface::Compiler>::enter::<rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}::{closure#2}, core[b97a30f8df81432d]::result::Result<core[b97a30f8df81432d]::option::Option<rustc_interface[ee1a3f92e887e004]::queries::Linker>, rustc_errors[21897ed46328f955]::ErrorGuaranteed>>
  44:     0x7f5dff07eac2 - rustc_span[14998722174c1bca]::with_source_map::<core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>, rustc_interface[ee1a3f92e887e004]::interface::run_compiler<core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  45:     0x7f5dff07e5b9 - <scoped_tls[23afcff80b89ba49]::ScopedKey<rustc_span[14998722174c1bca]::SessionGlobals>>::set::<rustc_interface[ee1a3f92e887e004]::interface::run_compiler<core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>
  46:     0x7f5dff07dbc8 - std[bbad73ae434e23e5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ee1a3f92e887e004]::util::run_in_thread_pool_with_globals<rustc_interface[ee1a3f92e887e004]::interface::run_compiler<core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>
  47:     0x7f5dff07d8ec - <<std[bbad73ae434e23e5]::thread::Builder>::spawn_unchecked_<rustc_interface[ee1a3f92e887e004]::util::run_in_thread_pool_with_globals<rustc_interface[ee1a3f92e887e004]::interface::run_compiler<core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>::{closure#1} as core[b97a30f8df81432d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:     0x7f5e00a276a3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4273f95ec44459b3
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:1987:9
  49:     0x7f5e00a276a3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h70f28fa4ddc269e5
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:1987:9
  50:     0x7f5e00a276a3 - std::sys::unix::thread::Thread::new::thread_start::h85a9c16b988e2bd0
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys/unix/thread.rs:108:17
  51:     0x7f5dfc88cded - start_thread
  52:     0x7f5dfc912370 - __GI___clone3
  53:                0x0 - <unknown>

@saethlin
Copy link
Member

saethlin commented Jul 1, 2023

Oh wow I didn't know anyone actually hit this so long ago! I turned this into a much nicer panic a few months ago: #110632

@bors bors closed this as completed in 6f65ef5 Jul 17, 2023
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Jul 18, 2023
Use u64 for incr comp allocation offsets

Fixes rust-lang/rust#76037
Fixes rust-lang/rust#95780
Fixes rust-lang/rust#111613

These issues are all reporting ICEs caused by using `u32` to store offsets to allocations in the incremental compilation cache. This PR aims to lift that limitation by changing the offset type in question to `u64`.

There are two perf runs in this PR. The first reports a regression, and the second does not. The changes are the same in both. I rebased the PR then did the second perf run because I noticed that the primary regression in it was very commonly seen in spurious regression reports.

I do not know what the perf run will report when this is merged. I would not be surprised to see regression or neutral, but the cachegrind diffs for the regression point at `try_mark_previous_green` which is a common source of inexplicable regressions and I don't think should be perturbed by this PR.

I'm not opposed to adding a regression test such as
```rust
fn main() {
    println!("{}", [37; 1 << 30].len());
}
```
But that program takes 1 minute to compile and consumes 4.6 GB of memory then writes that much to disk. Is that a concerning amount of resource use for a test?

r? `@nnethercote`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-incr-comp Working group: Incremental compilation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants