From: Ira Rosen Date: Thu, 11 Sep 2008 12:08:01 +0000 (+0000) Subject: re PR tree-optimization/37474 (vect_supported_slp_permutation_p memory corruption) X-Git-Tag: releases/gcc-4.4.0~2495 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c9dbe18eece0ad55ed8d8177d8061d445cf6fbc;p=thirdparty%2Fgcc.git re PR tree-optimization/37474 (vect_supported_slp_permutation_p memory corruption) PR tree-optimization/37474 * tree-vect-analyze.c (vect_supported_load_permutation_p): Check the length of load permutation. From-SVN: r140276 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce9936f4fb83..113943c0c0bf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-09-11 Ira Rosen + + PR tree-optimization/37474 + * tree-vect-analyze.c (vect_supported_load_permutation_p): Check the + length of load permutation. + 2008-09-11 Andreas Schwab * config/m68k/m68k.h (IRA_COVER_CLASSES): Define. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 50f7b1539dbe..85bb2a598b7f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-09-11 Ira Rosen + + PR tree-optimization/37474 + * gcc.dg/vect/pr37474.c: New test. + 2008-09-11 Andreas Schwab * 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 index 000000000000..b6d01c269dc2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr37474.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ + +#include + +#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" } } */ + diff --git a/gcc/tree-vect-analyze.c b/gcc/tree-vect-analyze.c index 06e004c34bbd..405ac35d9f05 100644 --- a/gcc/tree-vect-analyze.c +++ b/gcc/tree-vect-analyze.c @@ -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++) {