Rust-GCC / Rust-GCC/gccrs

ICE in find_ref_node_id, at rust/checks/lints/rust-lint-marklive.cc:305

Open
#3,564 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):

//

fn main() {
    match 0 {
        factor if (-f64::from_bits(0x1))() => {}
        1 => {}
        _ => {}
    }
}

original:

// run-pass
// compile-flags:-g
// ignore-asmjs wasm2js does not support source maps yet

// In this test we just want to make sure that the code below does not lead to
// invoke via type alias
// closure in the guard being codegened twice due to how match expressions are
// handled.
//
// See https://github.com/rust-lang/rust/issues/34569 for details.

fn main() {
    match 0 {
        factor if (-f64::from_bits(0x1))() => {},
        1 => {},
        _ => {}
    }
}

Version information:

a988708b4ba2b5a27715ea34c09ccfd3ed5143ca

Command:
crab1 -Warray-bounds -mtune=generic -march=x86-64 -O0 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -frust-incomplete-and-experimental-compiler-do-not-use

Program output

crab1: internal compiler error: in find_ref_node_id, at rust/checks/lints/rust-lint-marklive.cc:305
0x86daed Rust::Analysis::MarkLive::find_ref_node_id(unsigned int, unsigned int&)
	../../gcc/rust/checks/lints/rust-lint-marklive.cc:305
0x86daed Rust::Analysis::MarkLive::find_ref_node_id(unsigned int, unsigned int&)
	../../gcc/rust/checks/lints/rust-lint-marklive.cc:286
0xfaa5df Rust::Analysis::MarkLive::visit(Rust::HIR::PathInExpression&)
	../../gcc/rust/checks/lints/rust-lint-marklive.cc:118
0xfab60c Rust::Analysis::MarkLive::visit(Rust::HIR::CallExpr&)
	../../gcc/rust/checks/lints/rust-lint-marklive.h:160
0xfab60c Rust::Analysis::MarkLive::visit(Rust::HIR::CallExpr&)
	../../gcc/rust/checks/lints/rust-lint-marklive.h:160
0xfaba66 Rust::Analysis::MarkLive::visit(Rust::HIR::MatchExpr&)
	../../gcc/rust/checks/lints/rust-lint-marklive.h:209
0xfa9f11 Rust::Analysis::MarkLive::go(Rust::HIR::Crate&)
	../../gcc/rust/checks/lints/rust-lint-marklive.cc:93
0xfaa22b Rust::Analysis::MarkLive::Analysis(Rust::HIR::Crate&)
	../../gcc/rust/checks/lints/rust-lint-marklive.cc:73
0xc61299 Rust::Analysis::ScanDeadcode::Scan(Rust::HIR::Crate&)
	../../gcc/rust/checks/lints/rust-lint-scan-deadcode.h:45
0xc5c5ba Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:739
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 rust/checks/lints/rust-lint-marklive.cc at find_ref_node_id, then reproduce the ICE with the reduced Rust match expression and the reported crab1 command. Trace the MarkLive calls shown in the backtrace and verify that 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
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.