ICE tree check: expected integer_cst, have plus_expr in get_len, at tree.h:6475
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):
fn main() {
let _ = [0; (&0 as *const usize) as usize];
}
original:
fn main() {
let _ = [0; (&0 as *const usize) as usize]; //~ ERROR casting pointers to integers in constants
//~^ ERROR evaluation of constant value failed
}
Version information:
a988708b4ba2b5a27715ea34c09ccfd3ed5143ca
Command:
crab1 -Warray-bounds -mtune=generic -march=x86-64 -O0 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -frust-incomplete-and-experimental-compiler-do-not-use
Program output
crab1: internal compiler error: tree check: expected integer_cst, have plus_expr in get_len, at tree.h:6475
0x9933d5 tree_check_failed(tree_node const*, char const*, int, char const*, ...)
../../gcc/tree.cc:8955
0x87093e tree_check(tree_node const*, char const*, int, char const*, tree_code)
../../gcc/tree.h:3900
0x87093e wi::extended_tree<128>::get_len() const
../../gcc/tree.h:6475
0x87093e wi::int_traits<generic_wide_int<wi::extended_tree<128> > >::decompose(long*, unsigned int, generic_wide_int<wi::extended_tree<128> > const&)
../../gcc/wide-int.h:1050
0x87093e wide_int_ref_storage<true, false>::wide_int_ref_storage<generic_wide_int<wi::extended_tree<128> > >(generic_wide_int<wi::extended_tree<128> > const&, unsigned int)
../../gcc/wide-int.h:1099
0x87093e generic_wide_int<wide_int_ref_storage<true, false> >::generic_wide_int<generic_wide_int<wi::extended_tree<128> > >(generic_wide_int<wi::extended_tree<128> > const&, unsigned int)
../../gcc/wide-int.h:855
0x87093e wi::binary_traits<generic_wide_int<wi::extended_tree<128> >, generic_wide_int<wi::extended_tree<128> >, wi::int_traits<generic_wide_int<wi::extended_tree<128> > >::precision_type, wi::int_traits<generic_wide_int<wi::extended_tree<128> > >::precision_type>::result_type wi::sub<generic_wide_int<wi::extended_tree<128> >, generic_wide_int<wi::extended_tree<128> > >(generic_wide_int<wi::extended_tree<128> > const&, generic_wide_int<wi::extended_tree<128> > const&)
../../gcc/wide-int.h:2961
0x87093e wi::binary_traits<generic_wide_int<wi::extended_tree<128> >, generic_wide_int<wi::extended_tree<128> >, wi::int_traits<generic_wide_int<wi::extended_tree<128> > >::precision_type, wi::int_traits<generic_wide_int<wi::extended_tree<128> > >::precision_type>::operator_result operator-<generic_wide_int<wi::extended_tree<128> >, generic_wide_int<wi::extended_tree<128> > >(generic_wide_int<wi::extended_tree<128> > const&, generic_wide_int<wi::extended_tree<128> > const&)
../../gcc/wide-int.h:3858
0x87093e Rust::Compile::CompileExpr::array_copied_expr(unsigned int, Rust::TyTy::ArrayType const&, tree_node*, Rust::HIR::ArrayElemsCopied&)
../../gcc/rust/backend/rust-compile-expr.cc:1951
0xfec953 ???
../../gcc/rust/backend/rust-compile-expr.h:42
0xfe0c20 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile-expr.cc:47
0xfdbb71 Rust::Compile::CompileStmt::visit(Rust::HIR::LetStmt&)
../../gcc/rust/backend/rust-compile-stmt.cc:71
0xfdbd8d Rust::Compile::CompileStmt::Compile(Rust::HIR::Stmt*, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile-stmt.cc:36
0x100c05b Rust::Compile::HIRCompileBase::compile_function_body(tree_node*, Rust::HIR::BlockExpr&, Rust::TyTy::BaseType*)
../../gcc/rust/backend/rust-compile-base.cc:579
0x100fb8c Rust::Compile::HIRCompileBase::compile_function(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, 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 int, Rust::HIR::BlockExpr*, Rust::Resolver::CanonicalPath const&, Rust::TyTy::FnType*)
../../gcc/rust/backend/rust-compile-base.cc:761
0xfd7c2d Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
../../gcc/rust/backend/rust-compile-item.cc:256
0xc64954 Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned int)
../../gcc/rust/backend/rust-compile-item.h:37
0xc64954 Rust::Compile::CompileCrate::go()
../../gcc/rust/backend/rust-compile.cc:48
0xc64a3b Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile.cc:41
0xc5c44b Rust::Session::compile_crate(char const*)
../../gcc/rust/rust-session-manager.cc:733
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
Reproduce the reduced Rust case with the command shown, then start at gcc/rust/backend/rust-compile-expr.cc:1951 and trace the wide-int calls through wide-int.h to tree.h:6475. Compare the generated tree with the expected integer constant handling; done means this input no longer triggers the ICE and reports the expected constant-evaluation errors.
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
- Clearly specified
- Newbie friendliness
- 45/100