]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/40550 (Segmentation fault caused by alignment error in sse...
authorUros Bizjak <ubizjak@gmail.com>
Sun, 28 Jun 2009 23:12:37 +0000 (01:12 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Sun, 28 Jun 2009 23:12:37 +0000 (01:12 +0200)
PR tree-optimization/40550
* tree-vect-generic.c (expand_vector_operations_1): Compute in
vector_compute_type only when the size of vector_compute_type is
less than the size of type.

testsuite/ChangeLog:

PR tree-optimization/40550
* gcc.dg/pr40550.c: New test.

From-SVN: r149040

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr40550.c [new file with mode: 0644]
gcc/tree-vect-generic.c

index 2af5b4801242604b91621aefdb3f4ebc1f8618d3..a1763870e0df39c500f875086ea19b0d2572b6a2 100644 (file)
@@ -1,3 +1,10 @@
+2009-06-28  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR tree-optimization/40550
+       * tree-vect-generic.c (expand_vector_operations_1): Compute in
+       vector_compute_type only when the size of vector_compute_type is
+       less than the size of type.
+
 2009-06-27  Kai Tietz  <kai.tietz@onevision.com>
 
        Merged from trunk rev/148061
index 52f7de0f29166600c795868e2f74a05f4048e6a0..c5d17fef3798e9e7eb870ec57e0be6e683f34f16 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-28  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR tree-optimization/40550
+       * gcc.dg/pr40550.c: New test.
+
 2009-06-25  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/pr40550.c b/gcc/testsuite/gcc.dg/pr40550.c
new file mode 100644 (file)
index 0000000..27935ab
--- /dev/null
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-msse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#ifdef __i386__
+#include "cpuid.h"
+#endif
+
+typedef float v2sf __attribute__ ((vector_size (2 * sizeof(float))));
+
+static void test (void)
+{
+  v2sf a = {1.0, 0.0};
+  v2sf b = {0.0, 1.0};
+  v2sf d;
+  d = a + b;
+}
+
+int main ()
+{
+
+#ifdef __i386__
+  unsigned int eax, ebx, ecx, edx;
+
+  if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
+    return 0;
+
+  if (!(edx & bit_SSE))
+    return 0;
+#endif
+
+  test ();
+
+  return 0;
+}
index 76a51e0f090b01fa07119ad61dc85431f8a67972..37ed2d13d5b80c6ebdc20e37fbe9f0849d330e0d 100644 (file)
@@ -467,8 +467,10 @@ expand_vector_operations_1 (block_stmt_iterator *bsi)
       tree vector_compute_type
         = type_for_widest_vector_mode (TYPE_MODE (TREE_TYPE (type)), op,
                                       TYPE_SATURATING (TREE_TYPE (type)));
-      if (vector_compute_type != NULL_TREE)
-        compute_type = vector_compute_type;
+      if (vector_compute_type != NULL_TREE
+         && (TYPE_VECTOR_SUBPARTS (vector_compute_type)
+             < TYPE_VECTOR_SUBPARTS (compute_type)))
+       compute_type = vector_compute_type;
     }
 
   /* If we are breaking a BLKmode vector into smaller pieces,