Rust-GCC / Rust-GCC/gccrs

ICE: `in lower_pattern, at rust/checks/errors/rust-hir-pattern-analysis.cc`

Open
#3,940 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

original:

// run-pass

pub enum NonExhaustiveVariants {
    #[non_exhaustive] Tuple(u32),
    #[non_exhaustive] Struct { field: u32 }
}

fn main() {
    let variant_tuple = NonExhaustiveVariants::Tuple(340);
    let _variant_struct = NonExhaustiveVariants::Struct { field: 340 };

    match variant_tuple {
        NonExhaustiveVariants::Tuple(_fe_tpl) => "",
        NonExhaustiveVariants::Struct { field: NonExhaustiveVariants::Tuple(_fe_tpl) } => ""
    };
}

Version information:

5c3e2adc695b04a199d37cacd8c23b14fdab914f

Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/5c3e2adc695b04a199d37cacd8c23b14fdab914f/gcc/rust/checks/errors/rust-hir-pattern-analysis.cc:1349

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 lower_pattern, at rust/checks/errors/rust-hir-pattern-analysis.cc:1349
0x2fec938 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:517
0xc0dfbb fancy_abort(char const*, int, char const*)
	../../gcc/diagnostic.cc:1803
0x908677 lower_pattern
	../../gcc/rust/checks/errors/rust-hir-pattern-analysis.cc:1349
0x113a6f2 lower_struct_pattern
	../../gcc/rust/checks/errors/rust-hir-pattern-analysis.cc:1283
0x113b7e9 lower_pattern
	../../gcc/rust/checks/errors/rust-hir-pattern-analysis.cc:1381
0x11431bd lower_arm
	../../gcc/rust/checks/errors/rust-hir-pattern-analysis.cc:1441
0x11431bd Rust::Analysis::check_match_usefulness(Rust::Resolver::TypeCheckContext*, Rust::TyTy::BaseType*, Rust::HIR::MatchExpr&)
	../../gcc/rust/checks/errors/rust-hir-pattern-analysis.cc:1593
0x1146371 Rust::Analysis::PatternChecker::visit(Rust::HIR::MatchExpr&)
	../../gcc/rust/checks/errors/rust-hir-pattern-analysis.cc:418
0x1135333 Rust::Analysis::PatternChecker::visit(Rust::HIR::BlockExpr&)
	../../gcc/rust/checks/errors/rust-hir-pattern-analysis.cc:291
0x1136163 Rust::Analysis::PatternChecker::go(Rust::HIR::Crate&)
	../../gcc/rust/checks/errors/rust-hir-pattern-analysis.cc:48
0xdb97b7 Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:692
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 with the Rust reproducer in the issue and inspect lower_pattern and lower_struct_pattern in gcc/rust/checks/errors/rust-hir-pattern-analysis.cc, especially line 1349. Run crab1 with the provided source and compiler option to confirm the ICE. Done means this match no longer aborts compilation and the reproducer is covered by a regression test.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.