From 0ff8139c73436ea72ae8cf248828666b2afe8a82 Mon Sep 17 00:00:00 2001 From: jakub Date: Tue, 2 Oct 2012 13:43:09 +0000 Subject: PR tree-optimization/54713 * expr.c (categorize_ctor_elements_1): Don't assume purpose is non-NULL. * tree-cfg.c (verify_gimple_assign_single): Add verification of vector CONSTRUCTORs. * tree-ssa-sccvn.c (vn_reference_lookup_3): For VECTOR_TYPE CONSTRUCTORs, don't do anything if element type is VECTOR_TYPE, and don't check index. * tree-vect-slp.c (vect_get_constant_vectors): VIEW_CONVERT_EXPR ctor elements first if their type isn't compatible with vector element type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191983 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-cfg.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'gcc/tree-cfg.c') diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 774e74f2a54..b14a3b929f5 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -4000,6 +4000,80 @@ verify_gimple_assign_single (gimple stmt) return res; case CONSTRUCTOR: + if (TREE_CODE (rhs1_type) == VECTOR_TYPE) + { + unsigned int i; + tree elt_i, elt_v, elt_t = NULL_TREE; + + if (CONSTRUCTOR_NELTS (rhs1) == 0) + return res; + /* For vector CONSTRUCTORs we require that either it is empty + CONSTRUCTOR, or it is a CONSTRUCTOR of smaller vector elements + (then the element count must be correct to cover the whole + outer vector and index must be NULL on all elements, or it is + a CONSTRUCTOR of scalar elements, where we as an exception allow + smaller number of elements (assuming zero filling) and + consecutive indexes as compared to NULL indexes (such + CONSTRUCTORs can appear in the IL from FEs). */ + FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (rhs1), i, elt_i, elt_v) + { + if (elt_t == NULL_TREE) + { + elt_t = TREE_TYPE (elt_v); + if (TREE_CODE (elt_t) == VECTOR_TYPE) + { + tree elt_t = TREE_TYPE (elt_v); + if (!useless_type_conversion_p (TREE_TYPE (rhs1_type), + TREE_TYPE (elt_t))) + { + error ("incorrect type of vector CONSTRUCTOR" + " elements"); + debug_generic_stmt (rhs1); + return true; + } + else if (CONSTRUCTOR_NELTS (rhs1) + * TYPE_VECTOR_SUBPARTS (elt_t) + != TYPE_VECTOR_SUBPARTS (rhs1_type)) + { + error ("incorrect number of vector CONSTRUCTOR" + " elements"); + debug_generic_stmt (rhs1); + return true; + } + } + else if (!useless_type_conversion_p (TREE_TYPE (rhs1_type), + elt_t)) + { + error ("incorrect type of vector CONSTRUCTOR elements"); + debug_generic_stmt (rhs1); + return true; + } + else if (CONSTRUCTOR_NELTS (rhs1) + > TYPE_VECTOR_SUBPARTS (rhs1_type)) + { + error ("incorrect number of vector CONSTRUCTOR elements"); + debug_generic_stmt (rhs1); + return true; + } + } + else if (!useless_type_conversion_p (elt_t, TREE_TYPE (elt_v))) + { + error ("incorrect type of vector CONSTRUCTOR elements"); + debug_generic_stmt (rhs1); + return true; + } + if (elt_i != NULL_TREE + && (TREE_CODE (elt_t) == VECTOR_TYPE + || TREE_CODE (elt_i) != INTEGER_CST + || compare_tree_int (elt_i, i) != 0)) + { + error ("vector CONSTRUCTOR with non-NULL element index"); + debug_generic_stmt (rhs1); + return true; + } + } + } + return res; case OBJ_TYPE_REF: case ASSERT_EXPR: case WITH_SIZE_EXPR: -- cgit v1.2.1