From 48f2e3734233184ff3b7e6f6bc0c27c474a76d29 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 9 Dec 2011 11:22:59 +0000 Subject: re PR tree-optimization/51482 (ice: invalid types in conversion to floating point) 2011-12-09 Richard Guenther PR tree-optimization/51482 * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): Make sure to only create REAL_TYPE and INTEGER_TYPE component vectors. * g++.dg/torture/pr51482.C: New testcase. From-SVN: r182156 --- gcc/tree-vect-stmts.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'gcc/tree-vect-stmts.c') diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 8589a85..046a76f 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -5705,6 +5705,10 @@ get_vectype_for_scalar_type_and_size (tree scalar_type, unsigned size) if (nbytes == 0) return NULL_TREE; + if (GET_MODE_CLASS (inner_mode) != MODE_INT + && GET_MODE_CLASS (inner_mode) != MODE_FLOAT) + 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)) @@ -5713,16 +5717,15 @@ get_vectype_for_scalar_type_and_size (tree scalar_type, unsigned size) /* For vector types of elements whose mode precision doesn't match their types precision we use a element type of mode precision. The vectorization routines will have to make sure - they support the proper result truncation/extension. */ + they support the proper result truncation/extension. + We also make sure to build vector types with INTEGER_TYPE + component type only. */ if (INTEGRAL_TYPE_P (scalar_type) - && GET_MODE_BITSIZE (inner_mode) != TYPE_PRECISION (scalar_type)) + && (GET_MODE_BITSIZE (inner_mode) != TYPE_PRECISION (scalar_type) + || TREE_CODE (scalar_type) != INTEGER_TYPE)) scalar_type = build_nonstandard_integer_type (GET_MODE_BITSIZE (inner_mode), TYPE_UNSIGNED (scalar_type)); - if (GET_MODE_CLASS (inner_mode) != MODE_INT - && GET_MODE_CLASS (inner_mode) != MODE_FLOAT) - return NULL_TREE; - /* We shouldn't end up building VECTOR_TYPEs of non-scalar components. When the component mode passes the above test simply use a type corresponding to that mode. The theory is that any use that -- cgit v1.1