Rust-GCC / Rust-GCC/gccrs

tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in visit, at rust/backend/rust-compile-pattern.cc:1255

Open
#4,161 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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
type X = ();

fn main() {
    let () = ::X = ();
}

original:

type X = ();

fn main() {
    let ()=::X = ();
}

Version information:

4db0cf74f64086e2bb2eff029c597239df8442e1

Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use

Program output

crab1: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in visit, at rust/backend/rust-compile-pattern.cc:1255
0x301e249 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:786
0xa8cfdd tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*)
	../../gcc/tree.cc:9234
0x90ea74 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*)
	../../gcc/tree.h:3888
0x90ea74 Rust::Compile::CompilePatternLet::visit(Rust::HIR::TuplePattern&)
	../../gcc/rust/backend/rust-compile-pattern.cc:1255
0x112add6 Rust::Compile::CompilePatternLet::Compile(Rust::HIR::Pattern*, tree_node*, Rust::TyTy::BaseType*, unsigned long, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-pattern.h:123
0x112add6 Rust::Compile::CompileStmt::visit(Rust::HIR::LetStmt&)
	../../gcc/rust/backend/rust-compile-stmt.cc:91
0x112ae8c Rust::Compile::CompileStmt::Compile(Rust::HIR::Stmt*, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-stmt.cc:36
0x115c84c Rust::Compile::HIRCompileBase::compile_function_body(tree_node*, Rust::HIR::BlockExpr&, Rust::TyTy::BaseType*)
	../../gcc/rust/backend/rust-compile-base.cc:607
0x11605dc 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:789
0x1129311 Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
	../../gcc/rust/backend/rust-compile-item.cc:220
0xe9008b Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned long)
	../../gcc/rust/backend/rust-compile-item.h:37
0xe9008b Rust::Compile::CompileCrate::go()
	../../gcc/rust/backend/rust-compile.cc:48
0xe9008b Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile.cc:41
0xe876a4 Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:729
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with the reduced Rust program and the listed compiler flag. Start at CompilePatternLet::visit in rust/backend/rust-compile-pattern.cc:1255, using the backtrace to trace the tuple-pattern compilation path. Done means this input no longer triggers the tree-check internal compiler error and the regression is covered by the compiler's test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.