This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, PR d/90446] Committed fix for segfault in build_function_type at gcc/tree.c:8539


Hi,

This patch fixes a segmentation fault in the D front-end when handling
built-in types that are PSImode.

D does not have the notion of integer types to be of any size other
than the fixed-sized byte, short, int, long, and cent types, however
integer types with non-standard sizes are still matched to D types by
comparing TYPE_SIZE_UNIT, and internally casted as appropriate.

Bootstrapped and regression tested the D testsuite on
x86_64-linux-gnu, with further checking done on cross-compiler targets
mips64vr-elf, msp430-elf, pdp11-aout, and visium-elf to verify the ICE
no longer persists.

Committed to trunk as r274767.

--
Iain
---
gcc/d/ChangeLog:

        PR d/90446
        * d-lang.cc (d_type_for_mode): Check for all internal __intN types.
        (d_type_for_size): Likewise.
---
diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc
index f23f719a2c3..db0db0e71dc 100644
--- a/gcc/d/d-lang.cc
+++ b/gcc/d/d-lang.cc
@@ -1360,6 +1360,17 @@ d_type_for_mode (machine_mode mode, int unsignedp)
   if (mode == TYPE_MODE (build_pointer_type (d_int_type)))
     return build_pointer_type (d_int_type);
 
+  for (int i = 0; i < NUM_INT_N_ENTS; i ++)
+    {
+      if (int_n_enabled_p[i] && mode == int_n_data[i].m)
+	{
+	  if (unsignedp)
+	    return int_n_trees[i].unsigned_type;
+	  else
+	    return int_n_trees[i].signed_type;
+	}
+    }
+
   if (COMPLEX_MODE_P (mode))
     {
       machine_mode inner_mode;
@@ -1408,6 +1419,17 @@ d_type_for_size (unsigned bits, int unsignedp)
   if (bits <= TYPE_PRECISION (d_cent_type))
     return unsignedp ? d_ucent_type : d_cent_type;
 
+  for (int i = 0; i < NUM_INT_N_ENTS; i ++)
+    {
+      if (int_n_enabled_p[i] && bits == int_n_data[i].bitsize)
+	{
+	  if (unsignedp)
+	    return int_n_trees[i].unsigned_type;
+	  else
+	    return int_n_trees[i].signed_type;
+	}
+    }
+
   return 0;
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]