]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Fix ICE with invalid const expression
authorPhilip Herron <herron.philip@googlemail.com>
Fri, 12 Sep 2025 15:37:32 +0000 (16:37 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 30 Oct 2025 19:59:13 +0000 (20:59 +0100)
commit182b2e65a68c8b77d2353b52bb4e852d75657a63
treef0e52c5dd1329a2249e9524cb9d9eefa98a21e3b
parent7a01b70d1b35e769ad54f13a2e6602cad39796fd
gccrs: Fix ICE with invalid const expression

This patch handles the overflowed var expression in the const block, so that
we error properly in the const expr code. It was missing some stuff from the
c++ implementation in how this should be handled properly.

Fixes Rust-GCC#4139

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (CompileExpr::compile_integer_literal): cleanup
* backend/rust-constexpr.cc (struct constexpr_global_ctx): port over c++ helpers
(decl_really_constant_value): likewise
(eval_constant_expression): likewise
(non_const_var_error): likewise

gcc/testsuite/ChangeLog:

* rust/compile/issue-4139.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/backend/rust-compile-expr.cc
gcc/rust/backend/rust-constexpr.cc
gcc/testsuite/rust/compile/issue-4139.rs [new file with mode: 0644]