public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] d: Fix build on aarch64-suse-linux
@ 2022-06-29 16:35 Iain Buclaw
  0 siblings, 0 replies; only message in thread
From: Iain Buclaw @ 2022-06-29 16:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: schwab, Iain Buclaw

Hi,

The variables being used to get the result out of TYPE_VECTOR_SUBPARTS
were being flagged by -Werror=maybe-uninitialized.  As they have already
been checked for being constant earlier, use `to_constant' instead.

This patch is based on feedback from Andreas.  Given the error they got,
this seems obvious.  Have only regstrapped on x86_64-linux-gnu though.

Regards,
Iain.

---
gcc/d/ChangeLog:

	* intrinsics.cc (build_shuffle_mask_type): Use to_constant when
	getting the number of subparts from a vector type.
	(expand_intrinsic_vec_shufflevector): Likewise.
---
 gcc/d/intrinsics.cc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/d/intrinsics.cc b/gcc/d/intrinsics.cc
index 454d940d1b5..75d43186909 100644
--- a/gcc/d/intrinsics.cc
+++ b/gcc/d/intrinsics.cc
@@ -273,8 +273,7 @@ build_shuffle_mask_type (tree type)
      printed (this should really be handled by a D tree printer).  */
   Type *t = build_frontend_type (inner);
   gcc_assert (t != NULL);
-  unsigned HOST_WIDE_INT nunits;
-  TYPE_VECTOR_SUBPARTS (type).is_constant (&nunits);
+  unsigned HOST_WIDE_INT nunits = TYPE_VECTOR_SUBPARTS (type).to_constant ();
 
   return build_ctype (TypeVector::create (t->sarrayOf (nunits)));
 }
@@ -1190,9 +1189,10 @@ expand_intrinsic_vec_shufflevector (tree callexp)
   tree vec0 = CALL_EXPR_ARG (callexp, 0);
   tree vec1 = CALL_EXPR_ARG (callexp, 1);
 
-  unsigned HOST_WIDE_INT v0elems, v1elems;
-  TYPE_VECTOR_SUBPARTS (TREE_TYPE (vec0)).is_constant (&v0elems);
-  TYPE_VECTOR_SUBPARTS (TREE_TYPE (vec1)).is_constant (&v1elems);
+  unsigned HOST_WIDE_INT v0elems =
+    TYPE_VECTOR_SUBPARTS (TREE_TYPE (vec0)).to_constant ();
+  unsigned HOST_WIDE_INT v1elems =
+    TYPE_VECTOR_SUBPARTS (TREE_TYPE (vec1)).to_constant ();
 
   unsigned HOST_WIDE_INT num_indices = call_expr_nargs (callexp) - 2;
   unsigned HOST_WIDE_INT masklen = MAX (num_indices, MAX (v0elems, v1elems));
-- 
2.34.1


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

only message in thread, other threads:[~2022-06-29 16:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 16:35 [committed] d: Fix build on aarch64-suse-linux Iain Buclaw

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