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, middle-end]: Fix rtl-optimization/32366, [4.3 Regression] Segfault in significand_size with -ftree-vectorize


Hello!

Sometimes vector modes wander into places that are not prepared to handle them. Attached patch fixes ICE in significand_size() by converting vector and complex modes into their inner mode before further processing.

Patch was tested on x86_64-pc-linux-gnu. OK for mainline?

2007-06-17 Uros Bizjak <ubizjak@gmail.com>

       PR rtl-optimization/32366
       * real.c (significand_size): Use inner mode for COMPLEX_MODE_P
       and VECTOR_MODE_P modes.

testsuite/ChangeLog:

2007-06-17 Uros Bizjak <ubizjak@gmail.com>

       PR rtl-optimization/32366
       * testsuite/gcc.dg/vect/pr32366.c: New test.

Uros.
Index: real.c
===================================================================
--- real.c	(revision 125766)
+++ real.c	(working copy)
@@ -2565,6 +2565,10 @@ significand_size (enum machine_mode mode
 {
   const struct real_format *fmt;
 
+  if (COMPLEX_MODE_P (mode)
+      || VECTOR_MODE_P (mode))
+    mode = GET_MODE_INNER (mode);
+
   fmt = REAL_MODE_FORMAT (mode);
   if (fmt == NULL)
     return 0;
Index: testsuite/gcc.dg/vect/pr32366.c
===================================================================
--- testsuite/gcc.dg/vect/pr32366.c	(revision 0)
+++ testsuite/gcc.dg/vect/pr32366.c	(revision 0)
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_float } */
+
+stream_test (void)
+{
+  static float input[20];
+  int k;
+  for (k = 0; k < 20; k++)
+    input[k] = k * 1.0;
+}
+

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