Rust-GCC / Rust-GCC/gccrs

ICE in adjust_temp_type, at rust/backend/rust-constexpr.cc:1539

Open
#3,536 0 comments 0 reactions 1 assignee View on GitHub

@philberty is already working on this.

Since Mar 28, 2025.

bug
Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

auto-reduced (treereduce-rust):

struct Foo(usize);

const fn get(x: Foo) -> usize {
    x.0
}

const X: Foo = Foo(22);

const Z: usize = get(*&X);

original:

// Regression test for #38520. Check that moves of `Foo` are not
// permitted as `Foo` is not copy (even in a static/const
//simple test to make sure that calls to `Pointer::fmt` aren't double counted

struct Foo(usize);

const fn get(x: Foo) -> usize {
    x.0
}

const X: Foo = Foo(22);
static Y: usize = get(*&X); //~ ERROR [E0507]
const Z: usize = get(*&X); //~ ERROR [E0507]

fn main() {
}

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 adjust_temp_type, at rust/backend/rust-constexpr.cc:1539
0x870d8f adjust_temp_type
	../../gcc/rust/backend/rust-constexpr.cc:1539
0xffbeeb rs_bind_parameters_in_call
	../../gcc/rust/backend/rust-constexpr.cc:3111
0xffbeeb eval_call_expression
	../../gcc/rust/backend/rust-constexpr.cc:3405
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
0x100d592 Rust::Compile::HIRCompileBase::compile_constant_item(unsigned int, Rust::TyTy::BaseType*, Rust::TyTy::BaseType*, Rust::Resolver::CanonicalPath const&, Rust::HIR::Expr&, unsigned int, unsigned int)
	../../gcc/rust/backend/rust-compile-base.cc:857
0xfd764d Rust::Compile::CompileItem::visit(Rust::HIR::ConstantItem&)
	../../gcc/rust/backend/rust-compile-item.cc:139
0xc64954 Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned int)
	../../gcc/rust/backend/rust-compile-item.h:37
0xc64954 Rust::Compile::CompileCrate::go()
	../../gcc/rust/backend/rust-compile.cc:48
0xc64a3b Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile.cc:41
0xc5c44b Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:733
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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.