public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2168] d: Fix d_signed_or_unsigned_type is invoked for vector types (PR110193)
@ 2023-06-28 15:53 Iain Buclaw
  0 siblings, 0 replies; only message in thread
From: Iain Buclaw @ 2023-06-28 15:53 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9757e4440bd8755d327601a60a73d57d712583ed

commit r14-2168-g9757e4440bd8755d327601a60a73d57d712583ed
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Wed Jun 28 17:38:16 2023 +0200

    d: Fix d_signed_or_unsigned_type is invoked for vector types (PR110193)
    
    This function can be invoked on VECTOR_TYPE, but the implementation
    assumes it works on integer types only.  To fix, added a check whether
    the type passed is any `__vector(T)' or non-integral type, and return
    early by calling `signed_or_unsigned_type_for()' instead.
    
    Problem was found by instrumenting TYPE_PRECISION and ICEing when
    applied on VECTOR_TYPEs.
    
            PR d/110193
    
    gcc/d/ChangeLog:
    
            * types.cc (d_signed_or_unsigned_type): Handle being called with any
            vector or non-integral type.

Diff:
---
 gcc/d/types.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/d/types.cc b/gcc/d/types.cc
index a4c05bfb75f..bdf07f83d4b 100644
--- a/gcc/d/types.cc
+++ b/gcc/d/types.cc
@@ -49,8 +49,8 @@ along with GCC; see the file COPYING3.  If not see
 static tree
 d_signed_or_unsigned_type (int unsignedp, tree type)
 {
-  if (TYPE_UNSIGNED (type) == (unsigned) unsignedp)
-    return type;
+  if (VECTOR_TYPE_P (type) || !ANY_INTEGRAL_TYPE_P (type))
+    return signed_or_unsigned_type_for (unsignedp, type);
 
   if (TYPE_PRECISION (type) == TYPE_PRECISION (d_cent_type))
     return unsignedp ? d_ucent_type : d_cent_type;

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

only message in thread, other threads:[~2023-06-28 15:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28 15:53 [gcc r14-2168] d: Fix d_signed_or_unsigned_type is invoked for vector types (PR110193) 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).