aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorFaisal Abbas <90.abbasfaisal@gmail.com>2022-08-23 17:47:59 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-08-25 12:40:28 +0100
commit5a8f2fd653afe2e60672678d9cbfe0fa8a5e4124 (patch)
treebf5cc532faae91c399f363bcfed30161b121e908 /gcc
parentf83e254c29dc3690603e06a98d94b3d39eb853d7 (diff)
downloadgcc-5a8f2fd653afe2e60672678d9cbfe0fa8a5e4124.zip
gcc-5a8f2fd653afe2e60672678d9cbfe0fa8a5e4124.tar.gz
gcc-5a8f2fd653afe2e60672678d9cbfe0fa8a5e4124.tar.bz2
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>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/backend/rust-compile-base.cc2
-rw-r--r--gcc/rust/backend/rust-compile-intrinsic.cc2
-rw-r--r--gcc/rust/backend/rust-constexpr.cc8
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 cde0f08..c56a0ea 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 ae50c8a..6169196 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 ed0fc2c..36da7cb 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