ICE in struct_field_expression (match)
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 -frust-crate-attr=no_core
enum E {
A,
B,
}
fn foo() {
match &E::A {
b @ (x @ E::A | x) => {}
}
}
original:
enum E { A, B }
fn foo() {
match &E::A {
b @ (x @ E::A | x) => {
let i: i8 = -0x80; // compiles fine
}
}
}
Version information:
696cb485cfa9969c952d6765889d82ed548ca15c
Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/696cb485cfa9969c952d6765889d82ed548ca15c/gcc/rust/rust-gcc.cc#L885-L897
Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core -frust-crate-attr=feature(no_core)
Program output
crab1: internal compiler error: in struct_field_expression, at rust/rust-gcc.cc:891
0x32c0107 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:787
0xc7e0b1 fancy_abort(char const*, int, char const*)
../../gcc/diagnostics/context.cc:1813
0x912188 Backend::struct_field_expression(tree_node*, unsigned long, unsigned long)
../../gcc/rust/rust-gcc.cc:891
0x912188 Backend::struct_field_expression(tree_node*, unsigned long, unsigned long)
../../gcc/rust/rust-gcc.cc:887
0x11a297a Rust::Compile::CompilePatternCheckExpr::visit(Rust::HIR::PathInExpression&)
../../gcc/rust/backend/rust-compile-pattern.cc:72
0x11a45aa ???
../../gcc/rust/backend/rust-compile-pattern.h:48
0x11a540c Rust::Compile::CompilePatternCheckExpr::visit(Rust::HIR::AltPattern&)
../../gcc/rust/backend/rust-compile-pattern.h:35
0x11a45aa ???
../../gcc/rust/backend/rust-compile-pattern.h:48
0x11b839a Rust::Compile::CompilePatternCheckExpr::Compile(Rust::HIR::Pattern&, tree_node*, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile-pattern.h:35
0x11b839a Rust::Compile::CompileExpr::visit(Rust::HIR::MatchExpr&)
../../gcc/rust/backend/rust-compile-expr.cc:1283
0x11b9d86 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile-expr.cc:56
0x11e85f3 Rust::Compile::HIRCompileBase::compile_function_body(tree_node*, Rust::HIR::BlockExpr&, Rust::TyTy::BaseType*)
../../gcc/rust/backend/rust-compile-base.cc:693
0x11e9ed3 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:886
0x11ace06 Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
../../gcc/rust/backend/rust-compile-item.cc:235
0xed334b Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned long)
../../gcc/rust/backend/rust-compile-item.h:37
0xed334b Rust::Compile::CompileCrate::go()
../../gcc/rust/backend/rust-compile.cc:48
0xed334b Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile.cc:41
0xec7647 Rust::Session::compile_crate(char const*)
../../gcc/rust/rust-session-manager.cc:851
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 /tmp/icemaker_global_tempdir.34aMiwYhsReh/rustc_testrunner_tmpdir_reporting.my8MHltEi66h/mvce.rs -o/tmp/icemaker_global_tempdir.34aMiwYhsReh/rustc_testrunner_tmpdir_reporting.my8MHltEi66h/binaryname -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core -frust-crate-attr=feature(no_core)
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 reproducer and the ICE backtrace, then inspect rust/rust-gcc.cc around lines 885-897 and rust/backend/rust-compile-pattern.cc at line 72. Trace how the match pattern reaches struct_field_expression and run the supplied command to reproduce the failure. Done means this input compiles without an internal compiler error and relevant compiler tests cover the case.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100