public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] rust-constexpr.cc: fixes - error in handling of NOP_EXPR which results in failure in make check-rust
@ 2022-08-29 15:35 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-08-29 15:35 UTC (permalink / raw)
  To: gcc-cvs

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-29 15:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-29 15:35 [gcc/devel/rust/master] rust-constexpr.cc: fixes - error in handling of NOP_EXPR which results in failure in make check-rust Thomas Schwinge

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).