ICE `in check_complete_insertion, at hash-table.h:578` const fn cycle
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 231
- Avg merge
- 19h 55m
- Merged PRs (30d)
- 67
Description
auto-reduced (treereduce-rust):
//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use
const fn a() -> usize {
b()
}
const fn b() -> usize {
a()
}
const ARR: [i32; a()] = [5; 6];
original:
//https://github.com/rust-lang/rust/issues/31364
const fn a() -> usize {
//~ ERROR non-item in item list
b()
}
const fn b() -> usize {
a()
}
const ARR: [i32; a()] = [5; 6];
fn main() {}
Version information:
5c3e2adc695b04a199d37cacd8c23b14fdab914f
Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/5c3e2adc695b04a199d37cacd8c23b14fdab914f/gcc/hash-table.h#L572-L584
Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use
Program output
crab1: internal compiler error: in check_complete_insertion, at hash-table.h:578
0x2fec938 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:517
0xc0dfbb fancy_abort(char const*, int, char const*)
../../gcc/diagnostic.cc:1803
0x118835e hash_table<Rust::Compile::rust_constexpr_call_hasher, false, xcallocator>::check_complete_insertion() const
../../gcc/hash-table.h:578
0x118835e hash_table<Rust::Compile::rust_constexpr_call_hasher, false, xcallocator>::find_slot_with_hash(Rust::Compile::rust_constexpr_call* const&, unsigned int, insert_option)
../../gcc/hash-table.h:1042
0x11796f7 hash_table<Rust::Compile::rust_constexpr_call_hasher, false, xcallocator>::find_slot(Rust::Compile::rust_constexpr_call* const&, insert_option)
../../gcc/hash-table.h:435
0x11796f7 eval_call_expression
../../gcc/rust/backend/rust-constexpr.cc:3476
0x117ad1b eval_constant_expression
../../gcc/rust/backend/rust-constexpr.cc:2099
0x1181948 eval_store_expression
../../gcc/rust/backend/rust-constexpr.cc:2655
0x117ac12 eval_constant_expression
../../gcc/rust/backend/rust-constexpr.cc:2176
0x117b981 eval_constant_expression
../../gcc/rust/backend/rust-constexpr.cc:2104
0x117bc18 eval_statement_list
../../gcc/rust/backend/rust-constexpr.cc:4657
0x117bc18 eval_constant_expression
../../gcc/rust/backend/rust-constexpr.cc:2182
0x117ad55 eval_constant_expression
../../gcc/rust/backend/rust-constexpr.cc:2186
0x11799e1 eval_call_expression
../../gcc/rust/backend/rust-constexpr.cc:3577
0x117ad1b eval_constant_expression
../../gcc/rust/backend/rust-constexpr.cc:2099
0x1181948 eval_store_expression
../../gcc/rust/backend/rust-constexpr.cc:2655
0x117ac12 eval_constant_expression
../../gcc/rust/backend/rust-constexpr.cc:2176
0x117b981 eval_constant_expression
../../gcc/rust/backend/rust-constexpr.cc:2104
0x117bc18 eval_statement_list
../../gcc/rust/backend/rust-constexpr.cc:4657
0x117bc18 eval_constant_expression
../../gcc/rust/backend/rust-constexpr.cc:2182
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Contributor guide
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
Run the reduced a.rs reproducer with the listed -frust-incomplete-and-experimental-compiler-do-not-use flag and confirm the ICE. Start in gcc/rust/backend/rust-constexpr.cc at eval_call_expression and inspect the rust_constexpr_call hash-table use, with gcc/hash-table.h:578 as the assertion site. Done means the recursive const fn input no longer triggers an internal compiler error and produces an appropriate result or diagnostic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100