Rust-GCC / Rust-GCC/gccrs

ICE `in create_tmp_var, at gimple-expr.cc:484` , `while let true = continue {}`

Open
#4,144 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
fn U256() {
    while let true = continue {}
}

original:

//@ run-pass
fn U256() {
    while let true = continue {}
}

Version information:

c742973c23448e321fba4d9ff98a9092dc0df7ba

Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/c742973c23448e321fba4d9ff98a9092dc0df7ba/gcc/gimple-expr.cc#L478-L490

Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use

Program output

In function ‘mvce::U256’:
crab1: internal compiler error: in create_tmp_var, at gimple-expr.cc:484
0x300c7d8 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:534
0xc23693 fancy_abort(char const*, int, char const*)
	../../gcc/diagnostics/context.cc:1640
0x97109f create_tmp_var(tree_node*, char const*)
	../../gcc/gimple-expr.cc:484
0xc9fe97 Backend::temporary_variable(tree_node*, tree_node*, tree_node*, tree_node*, bool, unsigned long, tree_node**)
	../../gcc/rust/rust-gcc.cc:2106
0xc9fe97 Backend::temporary_variable(tree_node*, tree_node*, tree_node*, tree_node*, bool, unsigned long, tree_node**)
	../../gcc/rust/rust-gcc.cc:2085
0x11374b5 Rust::Compile::CompileExpr::visit(Rust::HIR::MatchExpr&)
	../../gcc/rust/backend/rust-compile-expr.cc:1159
0x1138a16 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-expr.cc:52
0x112f750 ???
	../../gcc/rust/backend/rust-compile-stmt.h:33
0x112fa8c Rust::Compile::CompileStmt::Compile(Rust::HIR::Stmt*, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-stmt.cc:36
0x114769b Rust::Compile::CompileBlock::visit(Rust::HIR::BlockExpr&)
	../../gcc/rust/backend/rust-compile-block.cc:54
0x1147bfe Rust::Compile::CompileBlock::compile(Rust::HIR::BlockExpr&, Rust::Compile::Context*, Bvariable*)
	../../gcc/rust/backend/rust-compile-block.cc:35
0x1136f72 Rust::Compile::CompileExpr::visit(Rust::HIR::LoopExpr&)
	../../gcc/rust/backend/rust-compile-expr.cc:764
0x1138a16 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-expr.cc:52
0x11614b1 Rust::Compile::HIRCompileBase::compile_function_body(tree_node*, Rust::HIR::BlockExpr&, Rust::TyTy::BaseType*)
	../../gcc/rust/backend/rust-compile-base.cc:619
0x11651dc 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:789
0x112df11 Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
	../../gcc/rust/backend/rust-compile-item.cc:220
0xe90e4b Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned long)
	../../gcc/rust/backend/rust-compile-item.h:37
0xe90e4b Rust::Compile::CompileCrate::go()
	../../gcc/rust/backend/rust-compile.cc:48
0xe90e4b Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile.cc:41
0xe88464 Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:729
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 program with -frust-incomplete-and-experimental-compiler-do-not-use, then read gcc/gimple-expr.cc around line 484 and the Backend::temporary_variable and MatchExpr paths named in the backtrace. Trace how the while-let expression reaches create_tmp_var; done means the compiler no longer emits an internal compiler error for this reproducer.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.