Rust-GCC / Rust-GCC/gccrs

ICE in visit, at rust/backend/rust-compile-pattern.cc:550

Open
#3,632 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
struct Foo {
    x: isize,
}

fn main() {
    match Foo { 
        x: 3
    } {
        Foo {
            x: x
        } => {
     
}
    }
}

original:

struct Foo {
    x: isize,
}

fn main() {
    match Foo { //~ ERROR struct literals are not allowed here
        x: 3
    } {
        Foo {
            x: x
        } => {
    match Foo { //~ ERROR struct literals are not allowed here
        x: 3
    } {
        Foo {
            x: x
        } => {}
    }
}
    }
}

Version information:

765121736dfe3f5b319bbe9837880deda326394e

Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/765121736dfe3f5b319bbe9837880deda326394e/gcc/rust/backend/rust-compile-pattern.cc#L544-L556

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 visit, at rust/backend/rust-compile-pattern.cc:550
0xfd078f Rust::Compile::CompilePatternBindings::visit(Rust::HIR::StructPattern&)
	../../gcc/rust/backend/rust-compile-pattern.cc:550
0xfe94b3 Rust::Compile::CompilePatternBindings::Compile(Rust::HIR::Pattern&, tree_node*, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-pattern.h:78
0xfe94b3 Rust::Compile::CompileExpr::visit(Rust::HIR::MatchExpr&)
	../../gcc/rust/backend/rust-compile-expr.cc:1148
0xfe1840 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-expr.cc:47
0x100d102 Rust::Compile::HIRCompileBase::compile_function_body(tree_node*, Rust::HIR::BlockExpr&, Rust::TyTy::BaseType*)
	../../gcc/rust/backend/rust-compile-base.cc:603
0x1010c2c 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:773
0xfd882d Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
	../../gcc/rust/backend/rust-compile-item.cc:256
0xc64994 Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned int)
	../../gcc/rust/backend/rust-compile-item.h:37
0xc64994 Rust::Compile::CompileCrate::go()
	../../gcc/rust/backend/rust-compile.cc:48
0xc64a7b Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile.cc:41
0xc5c48b 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

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

Start by reproducing the ICE with the reduced Rust input and command provided in the issue. Inspect rust/backend/rust-compile-pattern.cc around lines 544-556 and follow the CompilePatternBindings::visit backtrace entry; done means this input no longer aborts in visit and the compiler handles the case without an internal 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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.