public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
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
Date: Mon, 29 Aug 2022 15:35:46 +0000 (GMT)	[thread overview]
Message-ID: <20220829153546.AB5C2385C31F@sourceware.org> (raw)

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, "%<reinterpret_cast%> 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

                 reply	other threads:[~2022-08-29 15:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220829153546.AB5C2385C31F@sourceware.org \
    --to=tschwinge@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).