Rust-GCC / Rust-GCC/gccrs

internal compiler error: in convert_tree, at rust/rust-gcc.cc:

Open
#4,474 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
#![feature(no_core)]
#![no_core]
fn main() {
    let mut a;
    struct S;
    // Error
    // Works
    enum E {
        A = 0,
        B = 1,
    }
    // Error
    (E::A {}, a) = (E::A, ()); // Works
}

original:

#![feature(no_core)]
#![no_core]
fn main() {
    let mut a;
    struct S;
    (S, a) = (S, ()); // Error
    (S {}, a) = (S, ()); // Works
    enum E {
    A = 0,
    B = 1,
}
    (E::A, a) = (E::A, ()); // Error
    (E::A {}, a) = (E::A, ()); // Works
}

Version information:

1a9102843099b18f9dbb6b5e979436f6c4566f1c

Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/1a9102843099b18f9dbb6b5e979436f6c4566f1c/gcc/rust/rust-gcc.cc#L1950-L1962

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 convert_tree, at rust/rust-gcc.cc:1956
0x3097ef9 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:787
0xc3aa61 fancy_abort(char const*, int, char const*)
	../../gcc/diagnostics/context.cc:1813
0x90dd3a Backend::convert_tree(tree_node*, tree_node*, unsigned long)
	../../gcc/rust/rust-gcc.cc:1956
0x90dd3a Backend::convert_tree(tree_node*, tree_node*, unsigned long)
	../../gcc/rust/rust-gcc.cc:1941
0xcc6cd9 Backend::constructor_expression(tree_node*, bool, std::vector<tree_node*, std::allocator<tree_node*> > const&, int, unsigned long)
	../../gcc/rust/rust-gcc.cc:1364
0x1136956 Rust::Compile::CompileExpr::visit(Rust::HIR::TupleExpr&)
	../../gcc/rust/backend/rust-compile-expr.cc:110
0x1136956 Rust::Compile::CompileExpr::visit(Rust::HIR::TupleExpr&)
	../../gcc/rust/backend/rust-compile-expr.cc:82
0x1137c27 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-expr.cc:52
0x1137c27 Rust::Compile::CompileExpr::visit(Rust::HIR::AssignmentExpr&)
	../../gcc/rust/backend/rust-compile-expr.cc:1074
0x113b516 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-expr.cc:52
0x1132450 ???
	../../gcc/rust/backend/rust-compile-stmt.h:33
0x113278c Rust::Compile::CompileStmt::Compile(Rust::HIR::Stmt*, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-stmt.cc:36
0x11651cc Rust::Compile::HIRCompileBase::compile_function_body(tree_node*, Rust::HIR::BlockExpr&, Rust::TyTy::BaseType*)
	../../gcc/rust/backend/rust-compile-base.cc:607
0x11693d1 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:809
0x1130c11 Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
	../../gcc/rust/backend/rust-compile-item.cc:231
0xe7fa0b Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned long)
	../../gcc/rust/backend/rust-compile-item.h:37
0xe7fa0b Rust::Compile::CompileCrate::go()
	../../gcc/rust/backend/rust-compile.cc:48
0xe7fa0b Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile.cc:41
0xe74e7e Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:810
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 /tmp/icemaker_global_tempdir.r6jYInQCIUD7/rustc_testrunner_tmpdir_reporting.H945cOjyAJfM/mvce.rs -o/tmp/icemaker_global_tempdir.r6jYInQCIUD7/rustc_testrunner_tmpdir_reporting.H945cOjyAJfM/binaryname -frust-incomplete-and-experimental-compiler-do-not-use
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 reduced Rust case with the command shown, then inspect gcc/rust/rust-gcc.cc:1950-1962 and the call path through gcc/rust/backend/rust-compile-expr.cc. Compare the failing tuple assignment with the working variants and determine why convert_tree reaches the internal error. Done means the reduced case no longer triggers an internal compiler 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
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.