[committed] d: Use HOST_WIDE_INT for type size temporaries.

Iain Buclaw ibuclaw@gdcproject.org
Thu Nov 18 23:46:09 GMT 2021


This patch fixes an issue with bootstrap on x86_64-darwin when building
with --enable-werror.

These couple variables are later used as the value for the format
specifier `%wd`, to which the expected type may not match dinteger_t,
causing unnecessary -Wformat warnings.

Bootstrapped and regression tested on x86_64-linux-gnu, committed to
mainline and backported to the releases/gcc-9, gcc-10, and gcc-11
branches as it's obvious what this is doing.



	* decl.cc (d_finish_decl): Use HOST_WIDE_INT for type size
 gcc/d/decl.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 0d46ee180e7..9c9205fa349 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -1544,8 +1544,9 @@ d_finish_decl (tree decl)
   if (flag_checking && DECL_INITIAL (decl))
       /* Initializer must never be bigger than symbol size.  */
-      dinteger_t tsize = int_size_in_bytes (TREE_TYPE (decl));
-      dinteger_t dtsize = int_size_in_bytes (TREE_TYPE (DECL_INITIAL (decl)));
+      HOST_WIDE_INT tsize = int_size_in_bytes (TREE_TYPE (decl));
+      HOST_WIDE_INT dtsize =
+	int_size_in_bytes (TREE_TYPE (DECL_INITIAL (decl)));
       if (tsize < dtsize)

More information about the Gcc-patches mailing list