From: Richard Guenther Date: Fri, 26 Feb 2010 13:34:38 +0000 (+0000) Subject: re PR tree-optimization/43188 ("error: alignment of array elements is greater than... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2f81659160adbbdb8ae6fbe80bbddfcf4bfcac13;p=gcc.git re PR tree-optimization/43188 ("error: alignment of array elements is greater than element size") 2010-02-26 Richard Guenther PR tree-optimization/43188 * tree-vect-stmts.c (get_vectype_for_scalar_type): Do not build vector types of over-aligned element type. * gcc.c-torture/compile/pr43188.c: New testcase. From-SVN: r157088 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c889ada3f7..047ba5e19bf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-02-26 Richard Guenther + + PR tree-optimization/43188 + * tree-vect-stmts.c (get_vectype_for_scalar_type): Do not build + vector types of over-aligned element type. + 2010-02-26 Uros Bizjak PR target/43175 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8c780474bcc..09fc468e48a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-02-26 Richard Guenther + + PR tree-optimization/43188 + * gcc.c-torture/compile/pr43188.c: New testcase. + 2010-02-26 H.J. Lu PR target/43175 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43188.c b/gcc/testsuite/gcc.c-torture/compile/pr43188.c new file mode 100644 index 00000000000..bbc6f422fcd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43188.c @@ -0,0 +1,6 @@ +int *__attribute__((__aligned__(16))) *p; + +int main (void) +{ + return **p; +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 99230909d7d..ce604b3dea6 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -4405,13 +4405,18 @@ tree get_vectype_for_scalar_type (tree scalar_type) { enum machine_mode inner_mode = TYPE_MODE (scalar_type); - int nbytes = GET_MODE_SIZE (inner_mode); + unsigned int nbytes = GET_MODE_SIZE (inner_mode); int nunits; tree vectype; if (nbytes == 0 || nbytes >= UNITS_PER_SIMD_WORD (inner_mode)) return NULL_TREE; + /* We can't build a vector type of elements with alignment bigger than + their size. */ + if (nbytes < TYPE_ALIGN_UNIT (scalar_type)) + return NULL_TREE; + /* FORNOW: Only a single vector size per mode (UNITS_PER_SIMD_WORD) is expected. */ nunits = UNITS_PER_SIMD_WORD (inner_mode) / nbytes;