Rust-GCC / Rust-GCC/gccrs

ICE in verify_ctor_sanity, at rust/backend/rust-constexpr.cc:1019

Open
#3,557 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
20h 2m
Merged PRs (30d)
66

Description

auto-reduced (treereduce-rust):

struct A {
    value: u32,
}

const fn new(value: u32) -> A {
    A { value }
}

const A_1: A = new(1);

original:

// run-pass
#![allow(unused_variables)]

// https://github.com/rust-lang/rust/issues/46114

#[doc(include="asdf.md")]
struct A { value: u32 }

const fn new(value: u32) -> A {
    A { value }
}

const A_1: A = new(1);
const A_2: A = new(2);

fn main() {
    let a_str = match new(42) {
        A_1 => "A 1",
        A_2 => "A 2",
        _ => "Unknown A",
    };
}

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 verify_ctor_sanity, at rust/backend/rust-constexpr.cc:1019
0x873f69 verify_ctor_sanity
	../../gcc/rust/backend/rust-constexpr.cc:1019
0x873f69 eval_bare_aggregate
	../../gcc/rust/backend/rust-constexpr.cc:1315
0xffe540 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2438
0x1004607 eval_store_expression
	../../gcc/rust/backend/rust-constexpr.cc:2660
0xffe38f eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2186
0xfff4f2 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2115
0xfff146 eval_statement_list
	../../gcc/rust/backend/rust-constexpr.cc:4658
0xfff146 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2192
0xffe092 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2196
0xffce0b eval_call_expression
	../../gcc/rust/backend/rust-constexpr.cc:3583
0xffe058 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2110
0x1004607 eval_store_expression
	../../gcc/rust/backend/rust-constexpr.cc:2660
0xffe38f eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2186
0xfff4f2 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2115
0xfff146 eval_statement_list
	../../gcc/rust/backend/rust-constexpr.cc:4658
0xfff146 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2192
0xffe092 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2196
0xffce0b eval_call_expression
	../../gcc/rust/backend/rust-constexpr.cc:3583
0xffe058 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2110
0x1000c50 Rust::Compile::fold_expr(tree_node*)
	../../gcc/rust/backend/rust-constexpr.cc:581
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 at rust/backend/rust-constexpr.cc:1019, particularly the verify_ctor_sanity path shown in the backtrace, and reproduce the ICE with the reduced Rust testcase and command from the report. Done means the testcase no longer triggers an internal compiler error and the relevant compiler behavior is covered by an appropriate regression test.

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.