From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23049 invoked by alias); 6 Sep 2006 06:30:23 -0000 Received: (qmail 23025 invoked by uid 48); 6 Sep 2006 06:30:13 -0000 Date: Wed, 06 Sep 2006 06:30:00 -0000 Message-ID: <20060906063013.23024.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/28915] [4.2 regression] ICE: tree check: expected class 'constant', have 'declaration' (var_decl) in build_vector, at tree.c:973 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pinskia at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-09/txt/msg00416.txt.bz2 List-Id: ------- Comment #9 from pinskia at gcc dot gnu dot org 2006-09-06 06:30 ------- And here is a testcase which is reproducible without the vectorizer: int t[4]; __attribute__((vector_size(16))) int f(void) { __attribute__((vector_size(16))) int t1 = {(int)&t[0], (int)&t[1], (int)&t[2], (int)&t[3]}; return t1; } -------------------- That testcase above shows more problems than I actually want to touch right now. Here was my fix for the x86 crash (but it does not fix the powerpc-linux with -maltivec crash): Index: tree.c =================================================================== --- tree.c (revision 116689) +++ tree.c (working copy) @@ -969,9 +969,11 @@ build_vector (tree type, tree vals) for (link = vals; link; link = TREE_CHAIN (link)) { tree value = TREE_VALUE (link); - - over1 |= TREE_OVERFLOW (value); - over2 |= TREE_CONSTANT_OVERFLOW (value); + if (CONSTANT_CLASS_P (value)) + { + over1 |= TREE_OVERFLOW (value); + over2 |= TREE_CONSTANT_OVERFLOW (value); + } } TREE_OVERFLOW (v) = over1; Index: expmed.c =================================================================== --- expmed.c (revision 116689) +++ expmed.c (working copy) @@ -4945,6 +4945,9 @@ make_tree (tree type, rtx x) switch (GET_CODE (x)) { + case CONST: + return make_tree (type, XEXP (x, 0)); + case CONST_INT: { HOST_WIDE_INT hi = 0; @@ -4979,6 +4982,7 @@ make_tree (tree type, rtx x) int i, units; rtx elt; tree t = NULL_TREE; + tree type1 = TREE_TYPE (type); units = CONST_VECTOR_NUNITS (x); @@ -4986,7 +4990,7 @@ make_tree (tree type, rtx x) for (i = units - 1; i >= 0; --i) { elt = CONST_VECTOR_ELT (x, i); - t = tree_cons (NULL_TREE, make_tree (type, elt), t); + t = tree_cons (NULL_TREE, make_tree (type1, elt), t); } return build_vector (type, t); @@ -5044,6 +5048,14 @@ make_tree (tree type, rtx x) GET_CODE (x) == ZERO_EXTEND); return fold_convert (type, make_tree (t, XEXP (x, 0))); + case SYMBOL_REF: + if (SYMBOL_REF_DECL (x)) + { + tree pointer; + t = SYMBOL_REF_DECL (x); + pointer = build_pointer_type (TREE_TYPE (t)); + return fold_convert (type, fold_build1 (ADDR_EXPR, pointer, t)); + } default: t = build_decl (VAR_DECL, NULL_TREE, type); -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|pinskia at gcc dot gnu dot |unassigned at gcc dot gnu |org |dot org Status|ASSIGNED |NEW http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28915