ICE: in operand_equal_p, at fold-const.cc:3449 &&main as fn == &main as fn
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
fn main() {
&(&(main as fn()) == &(main as fn()));
}
original:
// run-pass
fn main() {
// We shouldn't promote this
&(main as fn() == main as fn());
// Also check nested case
&(&(main as fn()) == &(main as extern "\x43" fn()));
}
Version information:
5c3e2adc695b04a199d37cacd8c23b14fdab914f
Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/5c3e2adc695b04a199d37cacd8c23b14fdab914f/gcc/fold-const.cc#L3443-L3455
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 operand_equal_p, at fold-const.cc:3449
0x2fec938 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:517
0xc0dfbb fancy_abort(char const*, int, char const*)
../../gcc/diagnostic.cc:1803
0x9541f2 operand_compare::operand_equal_p(tree_node*, tree_node const*, tree_node*, tree_node const*, unsigned int)
../../gcc/fold-const.cc:3449
0x142fba3 operand_compare::operand_equal_p(tree_node const*, tree_node const*, unsigned int)
../../gcc/fold-const.cc:3191
0x142fba3 operand_compare::verify_hash_value(tree_node const*, tree_node const*, unsigned int, bool*)
../../gcc/fold-const.cc:4303
0x142fba3 operand_compare::verify_hash_value(tree_node const*, tree_node const*, unsigned int, bool*)
../../gcc/fold-const.cc:4295
0x142fba3 operand_compare::operand_equal_p(tree_node*, tree_node const*, tree_node*, tree_node const*, unsigned int)
../../gcc/fold-const.cc:3205
0x2589e35 generic_simplify_EQ_EXPR(unsigned long, tree_code, tree_node*, tree_node*, tree_node*)
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/generic-match-8.cc:8738
0x144c061 fold_binary_loc(unsigned long, tree_code, tree_node*, tree_node*, tree_node*)
../../gcc/fold-const.cc:11036
0x1453efe fold_build2_loc(unsigned long, tree_code, tree_node*, tree_node*, tree_node*)
../../gcc/fold-const.cc:13953
0x1166cd7 Rust::Compile::CompileExpr::visit(Rust::HIR::ComparisonExpr&)
../../gcc/rust/backend/rust-compile-expr.cc:305
0x115e5aa ???
../../gcc/rust/backend/rust-compile-expr.h:56
0x115f6a2 ???
../../gcc/rust/backend/rust-compile-expr.h:64
0x1162ab6 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile-expr.cc:48
0x11596d0 ???
../../gcc/rust/backend/rust-compile-stmt.h:33
0x11599bc Rust::Compile::CompileStmt::Compile(Rust::HIR::Stmt*, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile-stmt.cc:36
0x118a83c Rust::Compile::HIRCompileBase::compile_function_body(tree_node*, Rust::HIR::BlockExpr&, Rust::TyTy::BaseType*)
../../gcc/rust/backend/rust-compile-base.cc:613
0x118d7c0 Rust::Compile::HIRCompileBase::compile_function(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, tl::optional<Rust::HIR::SelfParam>&, std::vector<Rust::HIR::FunctionParam, std::allocator<Rust::HIR::FunctionParam> >&, Rust::HIR::FunctionQualifiers const&, Rust::HIR::Visibility&, std::vector<Rust::AST::Attribute, std::allocator<Rust::AST::Attribute> >&, unsigned long, Rust::HIR::BlockExpr*, Rust::Resolver::CanonicalPath const&, Rust::TyTy::FnType*)
../../gcc/rust/backend/rust-compile-base.cc:791
0x1157e91 Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
../../gcc/rust/backend/rust-compile-item.cc:220
0xdbee6b Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned long)
../../gcc/rust/backend/rust-compile-item.h:37
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
Start with the reduced Rust input and the operand_equal_p path in gcc/fold-const.cc around lines 3443-3455, then inspect the comparison construction at gcc/rust/backend/rust-compile-expr.cc:305. Re-run crab1 with the reported flags against the reduced case; done means the input no longer triggers the internal compiler error.
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
- 38/100