Rust-GCC / Rust-GCC/gccrs

ICE in fold_binary_loc, at fold-const.cc:11235

Open
#3,593 1 comment 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):

fn sleep_ms() {
    [0; 1 % 0 * 1024 * 1024 * 1024];
}

original:

// check-pass


// Checks that the compiler does not actually try to allocate 4 TB during compilation and OOM crash.

fn sleep_ms() {
    [0; 1%0 * 1024 * 1024 * 1024];
}

Version information:

34b0a681598d52de442a0a21c3a7df20bf1485bc

Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/34b0a681598d52de442a0a21c3a7df20bf1485bc/gcc/fold-const.cc#L11229-L11241

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 fold_binary_loc, at fold-const.cc:11235
0x8b1175 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	../../gcc/fold-const.cc:11235
0xffea70 eval_binary_expression
	../../gcc/rust/backend/rust-constexpr.cc:3036
0xffea70 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2029
0x1005147 eval_store_expression
	../../gcc/rust/backend/rust-constexpr.cc:2660
0xffeecf eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2186
0x1000032 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2115
0xfffc86 eval_statement_list
	../../gcc/rust/backend/rust-constexpr.cc:4658
0xfffc86 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2192
0xffebd2 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2196
0xffd94b eval_call_expression
	../../gcc/rust/backend/rust-constexpr.cc:3583
0xffeb98 eval_constant_expression
	../../gcc/rust/backend/rust-constexpr.cc:2110
0x1001790 Rust::Compile::fold_expr(tree_node*)
	../../gcc/rust/backend/rust-constexpr.cc:581
0x100e0d2 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:869
0x100e6a2 Rust::Compile::HIRCompileBase::compile_constant_expr(Rust::Compile::Context*, 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:570
0xfee0a9 Rust::Compile::TyTyResolveCompile::visit(Rust::TyTy::ArrayType const&)
	../../gcc/rust/backend/rust-compile-type.cc:465
0xfef42c Rust::Compile::TyTyResolveCompile::compile(Rust::Compile::Context*, Rust::TyTy::BaseType const*, bool)
	../../gcc/rust/backend/rust-compile-type.cc:43
0xfed30e ???
	../../gcc/rust/backend/rust-compile-expr.h:42
0xfe1620 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-expr.cc:47
0xfdc3e0 ???
	../../gcc/rust/backend/rust-compile-stmt.h:33
0xfdc78d Rust::Compile::CompileStmt::Compile(Rust::HIR::Stmt*, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-stmt.cc:36
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.