diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-06-28 17:38:16 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-06-28 17:53:11 +0200 |
commit | 9757e4440bd8755d327601a60a73d57d712583ed (patch) | |
tree | 1ec21d8603217ecfb3b0c09495e46daa3dd4eeff | |
parent | 4de22e25918f6fe40184c444ba6d81b19b806e26 (diff) | |
download | gcc-9757e4440bd8755d327601a60a73d57d712583ed.zip gcc-9757e4440bd8755d327601a60a73d57d712583ed.tar.gz gcc-9757e4440bd8755d327601a60a73d57d712583ed.tar.bz2 |
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.
-rw-r--r-- | gcc/d/types.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/d/types.cc b/gcc/d/types.cc index a4c05bf..bdf07f8 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; |