d: Fix ICE: Segmentation fault in build_function_type at gcc/tree.c:8539
authorIain Buclaw <ibuclaw@gdcproject.org>
Wed, 21 Aug 2019 07:53:25 +0000 (07:53 +0000)
committerIain Buclaw <ibuclaw@gcc.gnu.org>
Wed, 21 Aug 2019 07:53:25 +0000 (07:53 +0000)
gcc/d/ChangeLog:

PR d/90446
* d-lang.cc (d_type_for_mode): Check for all internal __intN types.
(d_type_for_size): Likewise.

From-SVN: r274767

gcc/d/ChangeLog
gcc/d/d-lang.cc

index 6b692f5cf3594e67865a066982e90f75eecd13ce..41ea48e8b158121a8565fcff05ebf662cee86fbc 100644 (file)
@@ -1,3 +1,9 @@
+2019-08-20  Iain Buclaw  <ibuclaw@gdcproject.org>
+
+       PR d/90446
+       * d-lang.cc (d_type_for_mode): Check for all internal __intN types.
+       (d_type_for_size): Likewise.
+
 2019-08-20  Iain Buclaw  <ibuclaw@gdcproject.org>
 
        PR d/90445
index f23f719a2c377f165eed43948a2af99b10f11bf3..db0db0e71dc75aa728438ff81754e950898244ec 100644 (file)
@@ -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;
 }