public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Use correct format specifiers for unisnged HOST_WIDE_INT
@ 2022-06-08 12:42 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:42 UTC (permalink / raw)
To: gcc-cvs
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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 12:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:42 [gcc/devel/rust/master] Use correct format specifiers for unisnged HOST_WIDE_INT 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).