From 2f81659160adbbdb8ae6fbe80bbddfcf4bfcac13 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Fri, 26 Feb 2010 13:34:38 +0000 Subject: 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 --- gcc/tree-vect-stmts.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc/tree-vect-stmts.c') 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; -- cgit v1.1