re PR middle-end/28915 (ICE: tree check: expected class 'constant', have 'declaration' (var_decl) in build_vector, at tree.c:973)

PR middle-end/28915
        * gimplify.c (gimplify_init_constructor): Don't reduce TREE_CONSTANT
        vector ctors.
        * tree-cfg.c (verify_expr): Don't look into TREE_CONSTANT
        vector ctors.
        * expmed.c (make_tree): Handle CONST, SYMBOL_REF.
        * tree.c (build_vector): Handle non-_CST elements.

Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu>

From-SVN: r118747
This commit is contained in:
Jason Merrill 2006-11-13 03:16:11 -05:00 committed by Jason Merrill
parent 329b3cc384
commit 84816907e4
6 changed files with 52 additions and 0 deletions

View File

@ -1,3 +1,14 @@
2006-11-12 Jason Merrill <jason@redhat.com>
Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/28915
* gimplify.c (gimplify_init_constructor): Don't reduce TREE_CONSTANT
vector ctors.
* tree-cfg.c (verify_expr): Don't look into TREE_CONSTANT
vector ctors.
* expmed.c (make_tree): Handle CONST, SYMBOL_REF.
* tree.c (build_vector): Handle non-_CST elements.
2006-11-12 Kaz Kojima <kkojima@gcc.gnu.org>
* genemit.c (gen_insn): Call gen_exp with a non-null used

View File

@ -5044,6 +5044,15 @@ make_tree (tree type, rtx x)
GET_CODE (x) == ZERO_EXTEND);
return fold_convert (type, make_tree (t, XEXP (x, 0)));
case CONST:
return make_tree (type, XEXP (x, 0));
case SYMBOL_REF:
t = SYMBOL_REF_DECL (x);
if (t)
return fold_convert (type, build_fold_addr_expr (t));
/* else fall through. */
default:
t = build_decl (VAR_DECL, NULL_TREE, type);

View File

@ -3161,6 +3161,11 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
TREE_OPERAND (*expr_p, 1) = build_vector_from_ctor (type, elts);
break;
}
/* Don't reduce a TREE_CONSTANT vector ctor even if we can't
make a VECTOR_CST. It won't do anything for us, and it'll
prevent us from representing it as a single constant. */
break;
}
/* Vector types use CONSTRUCTOR all the way through gimple

View File

@ -0,0 +1,18 @@
/* PR middle-end/28915 */
/* { dg-options "-msse -O2 -ftree-vectorize -fdump-tree-vect" } */
extern char lanip[3][40];
typedef struct
{
char *t[4];
}tx_typ;
int set_names (void)
{
static tx_typ tt1;
int ln;
for (ln = 0; ln < 4; ln++)
tt1.t[ln] = lanip[1];
}
/* { dg-final { scan-tree-dump "vect_cst" "vect" } } */

View File

@ -3420,6 +3420,11 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
CHECK_OP (1, "invalid operand to binary operator");
break;
case CONSTRUCTOR:
if (TREE_CONSTANT (t) && TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
*walk_subtrees = 0;
break;
default:
break;
}

View File

@ -973,6 +973,10 @@ build_vector (tree type, tree vals)
{
tree value = TREE_VALUE (link);
/* Don't crash if we get an address constant. */
if (!CONSTANT_CLASS_P (value))
continue;
over1 |= TREE_OVERFLOW (value);
over2 |= TREE_CONSTANT_OVERFLOW (value);
}