Rust-GCC / Rust-GCC/gccrs

ICE: ‘verify_gimple’ failed

Open
#3,655 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
20h 2m
Merged PRs (30d)
66

Description

auto-reduced (treereduce-rust):

//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use
pub enum T {
    A(u64),
    B,
}

pub extern "C" fn t_add(a: T, b: T) -> u64 {
    match (a, b) {}
}

original:

#[repr(C, u8)]
pub enum TT {
    AA(u64, u64),
    BB,
}

#[no_mangle]
pub extern "C" fn tt_add(a: TT, b: TT) -> u64 {
    match (a, b) {
        (TT::AA(a1, b1), TT::AA(a2, b2)) => a1 + a2 + b1 + b2,
        (TT::AA(a1, b1), TT::BB) => a1 + b1,
        (TT::BB, TT::AA(a1, b1)) => a1 + b1,
        _ => 0,
    }
}

#[repr(C, u8)]
pub enum T {
    A(u64),
    B,
}

#[no_mangle]
pub extern "C" fn t_add(a: T, b: T) -> u64 {
    match (a, b) {
        (TT(a), T::A(b)) => a + b,
        (T::A(a), T::B) => a,
        (T::B, T::A(b)) => b,
        _ => 0,
    }
}

Version information:

765121736dfe3f5b319bbe9837880deda326394e

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

Program output

/tmp/icemaker_global_tempdir.NKudfJBTYGQf/rustc_testrunner_tmpdir_reporting.6HbwrOV1kBsY/mvce.rs:6:24: warning: unused name ‘a’ [-Wunused-variable]
    6 | pub extern "C" fn t_add(a: T, b: T) -> u64 {
      |                        ^
/tmp/icemaker_global_tempdir.NKudfJBTYGQf/rustc_testrunner_tmpdir_reporting.6HbwrOV1kBsY/mvce.rs:6:30: warning: unused name ‘b’ [-Wunused-variable]
    6 | pub extern "C" fn t_add(a: T, b: T) -> u64 {
      |                              ^

Analyzing compilation unit
/tmp/icemaker_global_tempdir.NKudfJBTYGQf/rustc_testrunner_tmpdir_reporting.6HbwrOV1kBsY/mvce.rs: In function ‘mvce::t_add’:
/tmp/icemaker_global_tempdir.NKudfJBTYGQf/rustc_testrunner_tmpdir_reporting.6HbwrOV1kBsY/mvce.rs:6:5: error: non-trivial conversion in ‘constructor’
    6 | pub extern "C" fn t_add(a: T, b: T) -> u64 {
      |     ^~~~~~
u64
struct ()
D.127 = {};
/tmp/icemaker_global_tempdir.NKudfJBTYGQf/rustc_testrunner_tmpdir_reporting.6HbwrOV1kBsY/mvce.rs:6:5: internal compiler error: ‘verify_gimple’ failed
0x184fd4e verify_gimple_in_seq(gimple*, bool)
	../../gcc/tree-cfg.cc:5314
0x13f992a gimplify_body(tree_node*, bool)
	../../gcc/gimplify.cc:19136
0x13f9ada gimplify_function_tree(tree_node*)
	../../gcc/gimplify.cc:19252
0x11d3b97 cgraph_node::analyze()
	../../gcc/cgraphunit.cc:687
0x11d6f43 analyze_functions
	../../gcc/cgraphunit.cc:1251
0x11d81fd symbol_table::finalize_compilation_unit()
	../../gcc/cgraphunit.cc:2558
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 the shown -frust-incomplete-and-experimental-compiler-do-not-use command, then trace the failure from verify_gimple_in_seq in gcc/tree-cfg.cc through gimplify_body in gcc/gimplify.cc. Compare the generated GIMPLE around t_add and the non-trivial constructor diagnostic; done means this input compiles or fails with a proper diagnostic without 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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.