]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/37474 (vect_supported_slp_permutation_p memory corruption)
authorIra Rosen <irar@il.ibm.com>
Thu, 11 Sep 2008 12:08:01 +0000 (12:08 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Thu, 11 Sep 2008 12:08:01 +0000 (12:08 +0000)
PR tree-optimization/37474
* tree-vect-analyze.c (vect_supported_load_permutation_p): Check the
length of load permutation.

From-SVN: r140276

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

index ce9936f4fb8375e92f51b82bbb1e7022a2beb048..113943c0c0bfaba442175880e321e9e3994df6c3 100644 (file)
@@ -1,3 +1,9 @@
+2008-09-11  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/37474
+       * tree-vect-analyze.c (vect_supported_load_permutation_p): Check the
+       length of load permutation.
+
 2008-09-11  Andreas Schwab  <schwab@suse.de>
 
        * config/m68k/m68k.h (IRA_COVER_CLASSES): Define.
index 50f7b1539dbe18403e2cbde3144925a0a8cc547e..85bb2a598b7f08fe0123d91b6c6acc7372ce8b5f 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-11  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/37474
+       * gcc.dg/vect/pr37474.c: New test.
+
 2008-09-11  Andreas Schwab  <schwab@suse.de>
 
        * gcc.target/m68k/xgot-1.c: Add -mcpu=5206 to select a ColdFire
diff --git a/gcc/testsuite/gcc.dg/vect/pr37474.c b/gcc/testsuite/gcc.dg/vect/pr37474.c
new file mode 100644 (file)
index 0000000..b6d01c2
--- /dev/null
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+
+#define M00 100
+#define M10 216
+#define M01 1322
+#define M11 13
+#define M02 74
+#define M12 191
+
+#define N 16
+
+void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput)
+{
+  unsigned int i, a, b, c, d, e, f;
+
+  for (i = 0; i < N / 3; i++)
+    {
+       a = *pInput++;
+       b = *pInput++;
+       c = *pInput++;
+       d = *pInput++;
+       e = *pInput++;
+       f = *pInput++;
+
+       a = a + d;
+       b = b + e;
+       c = c + f;
+
+       *pOutput++ = M00 * a + M01 * b + M02 * c;
+       *pOutput++ = M10 * a + M11 * b + M12 * c;
+    }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
index 06e004c34bbd2e76f4c48df8f517bf902ae83da7..405ac35d9f0579a24703590f9fe4b7a9decd37c6 100644 (file)
@@ -3200,6 +3200,10 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size,
   /* FORNOW: the only supported permutation is 0..01..1.. of length equal to 
      GROUP_SIZE and where each sequence of same drs is of GROUP_SIZE length as 
      well.  */
+  if (VEC_length (int, load_permutation)
+      != (unsigned int) (group_size * group_size))
+    return false;
+
   supported = true;
   for (j = 0; j < group_size; j++)
     {