Rust-GCC / Rust-GCC/gccrs

segfault BaseType::get_kind()

Open
#4,616 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 -frust-crate-attr=no_core
pub fn main() {
    (|_, ()| ())();
}

original:

pub fn main() {
    (|_, ()| ())([return, ()]);
}

Version information:

696cb485cfa9969c952d6765889d82ed548ca15c

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

/tmp/icemaker_global_tempdir.RY1PwrhEurnc/rustc_testrunner_tmpdir_reporting.64zsnh8HM2wk/mvce.rs:2:10: sorry, unimplemented: unable to infer this kind of parameter pattern
    2 |     (|_, ()| ())();
      |          ^
crab1: internal compiler error: Segmentation fault
0x32c0107 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:787
0x1a7e17f crash_signal
	../../gcc/toplev.cc:325
0x103cde6 Rust::TyTy::BaseType::get_kind() const
	../../gcc/rust/typecheck/rust-tyty.cc:264
0x103cde6 bool Rust::TyTy::BaseType::is<Rust::TyTy::ParamType>() const
	../../gcc/rust/typecheck/rust-tyty.h:306
0x103cde6 Rust::TyTy::ParamType* Rust::TyTy::BaseType::try_as<Rust::TyTy::ParamType>()
	../../gcc/rust/typecheck/rust-tyty.h:344
0x103cde6 Rust::TyTy::BaseType::destructure()
	../../gcc/rust/typecheck/rust-tyty.cc:488
0x10c638e Rust::Resolver::TypeCheckPattern::visit(Rust::HIR::TuplePattern&)
	../../gcc/rust/typecheck/rust-hir-type-check-pattern.cc:623
0x10c126f Rust::Resolver::TypeCheckPattern::Resolve(Rust::HIR::Pattern&, Rust::TyTy::BaseType*)
	../../gcc/rust/typecheck/rust-hir-type-check-pattern.cc:40
0x10d3a5b Rust::Resolver::TypeCheckExpr::visit(Rust::HIR::ClosureExpr&)
	../../gcc/rust/typecheck/rust-hir-type-check-expr.cc:1876
0x10c8f30 Rust::Resolver::TypeCheckExpr::Resolve(Rust::HIR::Expr&)
	../../gcc/rust/typecheck/rust-hir-type-check-expr.cc:53
0x10ce5dc ???
	../../gcc/rust/typecheck/rust-hir-type-check-expr.h:62
0x10c8f30 Rust::Resolver::TypeCheckExpr::Resolve(Rust::HIR::Expr&)
	../../gcc/rust/typecheck/rust-hir-type-check-expr.cc:53
0x10d302a Rust::Resolver::TypeCheckExpr::visit(Rust::HIR::CallExpr&)
	../../gcc/rust/typecheck/rust-hir-type-check-expr.cc:231
0x10c8f30 Rust::Resolver::TypeCheckExpr::Resolve(Rust::HIR::Expr&)
	../../gcc/rust/typecheck/rust-hir-type-check-expr.cc:53
0x10d8b6c ???
	../../gcc/rust/typecheck/rust-hir-type-check-stmt.h:33
0x10d92f3 Rust::Resolver::TypeCheckStmt::Resolve(Rust::HIR::Stmt&)
	../../gcc/rust/typecheck/rust-hir-type-check-stmt.cc:34
0x10cb00d Rust::Resolver::TypeCheckExpr::visit(Rust::HIR::BlockExpr&)
	../../gcc/rust/typecheck/rust-hir-type-check-expr.cc:657
0x10c8f30 Rust::Resolver::TypeCheckExpr::Resolve(Rust::HIR::Expr&)
	../../gcc/rust/typecheck/rust-hir-type-check-expr.cc:53
0x109fc16 Rust::Resolver::TypeCheckItem::visit(Rust::HIR::Function&)
	../../gcc/rust/typecheck/rust-hir-type-check-item.cc:771
0x109749c Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
	../../gcc/rust/typecheck/rust-hir-type-check-item.cc:60
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 /tmp/icemaker_global_tempdir.RY1PwrhEurnc/rustc_testrunner_tmpdir_reporting.64zsnh8HM2wk/mvce.rs -o/tmp/icemaker_global_tempdir.RY1PwrhEurnc/rustc_testrunner_tmpdir_reporting.64zsnh8HM2wk/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

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 running the reduced Rust reproducer with the listed crab1 flags and confirm the segmentation fault. Trace the pattern path through rust/typecheck/rust-tyty.cc, rust/typecheck/rust-hir-type-check-pattern.cc, and rust/typecheck/rust-hir-type-check-expr.cc, focusing on BaseType::get_kind() and destructure(). Done means the input produces a diagnostic without crashing and has regression coverage in the gccrs tests.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.