From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id AB5C2385C31F; Mon, 29 Aug 2022 15:35:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB5C2385C31F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661787346; bh=8OcHEk+weldEfsmBUAhgiVzvdVzLdAlu8oKWWTmUfI0=; h=From:To:Subject:Date:From; b=c5kbpfwRXZn9G0GNYZ7rhIWzuvyFmJWIzCIdlIUpxe44rpfAqRzR3Xk9YndWZjiFT k9wnSOkjUc8il+C77YY8udcoXbV0cGXQ1C9dxkTTG0BtBdv00GirxvoHE3FyofGxN/ 2TDQ9OyNkBJOdpfHC0rxztXFTJWH3cNIQgSwKk/s= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] rust-constexpr.cc: fixes - error in handling of NOP_EXPR which results in failure in make check-rust X-Act-Checkin: gcc X-Git-Author: Faisal Abbas <90.abbasfaisal@gmail.com> X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: f83e254c29dc3690603e06a98d94b3d39eb853d7 X-Git-Newrev: 5a8f2fd653afe2e60672678d9cbfe0fa8a5e4124 Message-Id: <20220829153546.AB5C2385C31F@sourceware.org> Date: Mon, 29 Aug 2022 15:35:46 +0000 (GMT) List-Id: https://gcc.gnu.org/g:5a8f2fd653afe2e60672678d9cbfe0fa8a5e4124 commit 5a8f2fd653afe2e60672678d9cbfe0fa8a5e4124 Author: Faisal Abbas <90.abbasfaisal@gmail.com> Date: Tue Aug 23 17:47:59 2022 +0100 rust-constexpr.cc: fixes - error in handling of NOP_EXPR which results in failure in make check-rust - DECL not being marked constant inside finalize_intrinsic_block Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com> Diff: --- gcc/rust/backend/rust-compile-base.cc | 2 +- gcc/rust/backend/rust-compile-intrinsic.cc | 2 +- gcc/rust/backend/rust-constexpr.cc | 8 +------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc index cde0f085307..c56a0eab6de 100644 --- a/gcc/rust/backend/rust-compile-base.cc +++ b/gcc/rust/backend/rust-compile-base.cc @@ -701,7 +701,7 @@ HIRCompileBase::compile_constant_item ( gcc_assert (TREE_CODE (bind_tree) == BIND_EXPR); DECL_SAVED_TREE (fndecl) = bind_tree; - DECL_DECLARED_CONSTEXPR_P (fndecl); + DECL_DECLARED_CONSTEXPR_P (fndecl) = 1; maybe_save_constexpr_fundef (fndecl); ctx->pop_fn (); diff --git a/gcc/rust/backend/rust-compile-intrinsic.cc b/gcc/rust/backend/rust-compile-intrinsic.cc index ae50c8a3c02..616919677c9 100644 --- a/gcc/rust/backend/rust-compile-intrinsic.cc +++ b/gcc/rust/backend/rust-compile-intrinsic.cc @@ -215,7 +215,7 @@ finalize_intrinsic_block (Context *ctx, tree fndecl) ctx->push_function (fndecl); - DECL_DECLARED_CONSTEXPR_P (fndecl); + DECL_DECLARED_CONSTEXPR_P (fndecl) = 1; maybe_save_constexpr_fundef (fndecl); } diff --git a/gcc/rust/backend/rust-constexpr.cc b/gcc/rust/backend/rust-constexpr.cc index ed0fc2ce345..36da7cb26ab 100644 --- a/gcc/rust/backend/rust-constexpr.cc +++ b/gcc/rust/backend/rust-constexpr.cc @@ -5795,14 +5795,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, } return true; - case NOP_EXPR: - if (REINTERPRET_CAST_P (t)) - { - if (flags & tf_error) - error_at (loc, "% is not a constant expression"); - return false; - } /* FALLTHRU */ + case NOP_EXPR: case CONVERT_EXPR: case VIEW_CONVERT_EXPR: /* -- a reinterpret_cast. FIXME not implemented, and this rule