diff options
author | Richard Guenther <rguenther@suse.de> | 2010-02-26 13:34:38 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-02-26 13:34:38 +0000 |
commit | 2f81659160adbbdb8ae6fbe80bbddfcf4bfcac13 (patch) | |
tree | 34c433c5896a376908b666c2976d2a1df592a0e3 /gcc/tree-vect-stmts.c | |
parent | 7ce321b3e30e47927e1b25bcc132a5c329fd7de3 (diff) | |
download | gcc-2f81659160adbbdb8ae6fbe80bbddfcf4bfcac13.zip gcc-2f81659160adbbdb8ae6fbe80bbddfcf4bfcac13.tar.gz gcc-2f81659160adbbdb8ae6fbe80bbddfcf4bfcac13.tar.bz2 |
re PR tree-optimization/43188 ("error: alignment of array elements is greater than element size")
2010-02-26 Richard Guenther <rguenther@suse.de>
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
Diffstat (limited to 'gcc/tree-vect-stmts.c')
-rw-r--r-- | gcc/tree-vect-stmts.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 9923090..ce604b3 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; |