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] backend: Use build_int_cstu for size expressions
Date: Fri,  9 Dec 2022 09:29:41 +0000 (GMT)	[thread overview]
Message-ID: <20221209092941.3C960396C5C4@sourceware.org> (raw)

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

                 reply	other threads:[~2022-12-09  9:29 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=20221209092941.3C960396C5C4@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).