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] Use correct format specifiers for unisnged HOST_WIDE_INT
Date: Wed,  8 Jun 2022 12:42:27 +0000 (GMT)	[thread overview]
Message-ID: <20220608124227.3D537386CE62@sourceware.org> (raw)

https://gcc.gnu.org/g:48cad9e8aed699c396afb7592dd637f2e87723dc

commit 48cad9e8aed699c396afb7592dd637f2e87723dc
Author: Philip Herron <philip.herron@embecosm.com>
Date:   Tue May 3 16:16:12 2022 +0100

    Use correct format specifiers for unisnged HOST_WIDE_INT
    
    The code here was wrongly assuming the unsigned long interface which is not
    correcty for all targets.

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

diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc
index 5c9bbf90e66..db22227711e 100644
--- a/gcc/rust/backend/rust-compile.cc
+++ b/gcc/rust/backend/rust-compile.cc
@@ -492,7 +492,7 @@ HIRCompileBase::verify_array_capacities (tree ltype, tree rtype,
   if (!TREE_CONSTANT (TYPE_MAX_VALUE (ltype_domain)))
     return false;
 
-  auto ltype_length
+  unsigned HOST_WIDE_INT ltype_length
     = wi::ext (wi::to_offset (TYPE_MAX_VALUE (ltype_domain))
 		 - wi::to_offset (TYPE_MIN_VALUE (ltype_domain)) + 1,
 	       TYPE_PRECISION (TREE_TYPE (ltype_domain)),
@@ -506,7 +506,7 @@ HIRCompileBase::verify_array_capacities (tree ltype, tree rtype,
   if (!TREE_CONSTANT (TYPE_MAX_VALUE (rtype_domain)))
     return false;
 
-  auto rtype_length
+  unsigned HOST_WIDE_INT rtype_length
     = wi::ext (wi::to_offset (TYPE_MAX_VALUE (rtype_domain))
 		 - wi::to_offset (TYPE_MIN_VALUE (rtype_domain)) + 1,
 	       TYPE_PRECISION (TREE_TYPE (rtype_domain)),
@@ -515,10 +515,11 @@ HIRCompileBase::verify_array_capacities (tree ltype, tree rtype,
 
   if (ltype_length != rtype_length)
     {
-      rust_error_at (rvalue_locus,
-		     "expected an array with a fixed size of %lu "
-		     "elements, found one with %lu elements",
-		     ltype_length, rtype_length);
+      rust_error_at (
+	rvalue_locus,
+	"expected an array with a fixed size of " HOST_WIDE_INT_PRINT_UNSIGNED
+	" elements, found one with " HOST_WIDE_INT_PRINT_UNSIGNED " elements",
+	ltype_length, rtype_length);
       return false;
     }


                 reply	other threads:[~2022-06-08 12:42 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=20220608124227.3D537386CE62@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).