public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] backend: Use build_int_cstu for size expressions
@ 2022-12-09  9:29 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-12-09  9:29 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:50cd4d91e339233caf756f2366555ea8a01b5787

commit 50cd4d91e339233caf756f2366555ea8a01b5787
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Thu Nov 17 15:39:02 2022 +0100

    backend: Use build_int_cstu for size expressions

Diff:
---
 gcc/rust/backend/rust-compile-expr.cc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index e50df63821f..2c5c2b44d3f 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -2220,9 +2220,7 @@ CompileExpr::compile_string_literal (const HIR::LiteralExpr &expr,
   rust_assert (ok);
   tree type = TyTyResolveCompile::compile (ctx, usize);
 
-  mpz_t ival;
-  mpz_init_set_ui (ival, literal_value.as_string ().size ());
-  tree size = double_int_to_tree (type, mpz_get_double_int (type, ival, true));
+  tree size = build_int_cstu (type, literal_value.as_string ().size ());
 
   return ctx->get_backend ()->constructor_expression (fat_pointer, false,
 						      {data, size}, -1,
@@ -2618,7 +2616,7 @@ HIRCompileBase::resolve_unsized_slice_adjustment (
 	       TYPE_PRECISION (TREE_TYPE (domain)),
 	       TYPE_SIGN (TREE_TYPE (domain)))
 	.to_uhwi ();
-  tree size = build_int_cst (size_type_node, array_size);
+  tree size = build_int_cstu (size_type_node, array_size);
 
   return ctx->get_backend ()->constructor_expression (fat_pointer, false,
 						      {data, size}, -1, locus);

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

only message in thread, other threads:[~2022-12-09  9:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-09  9:29 [gcc/devel/rust/master] backend: Use build_int_cstu for size expressions 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).