summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 56e0554737e..4dcd3220390 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -9612,7 +9612,7 @@ vec_cst_ctor_to_array (tree arg, tree *elts)
{
constructor_elt *elt;
- FOR_EACH_VEC_ELT (constructor_elt, CONSTRUCTOR_ELTS (arg), i, elt)
+ FOR_EACH_VEC_SAFE_ELT (CONSTRUCTOR_ELTS (arg), i, elt)
if (i >= nelts || TREE_CODE (TREE_TYPE (elt->value)) == VECTOR_TYPE)
return false;
else
@@ -9657,7 +9657,8 @@ fold_vec_perm (tree type, tree arg0, tree arg1, const unsigned char *sel)
if (need_ctor)
{
- VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, nelts);
+ vec<constructor_elt, va_gc> *v;
+ vec_alloc (v, nelts);
for (i = 0; i < nelts; i++)
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, elts[2 * nelts + i]);
return build_constructor (type, v);
@@ -14094,15 +14095,16 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
}
else
{
- VEC(constructor_elt, gc) *vals;
+ vec<constructor_elt, va_gc> *vals;
unsigned i;
if (CONSTRUCTOR_NELTS (arg0) == 0)
- return build_constructor (type, NULL);
+ return build_constructor (type,
+ NULL);
if (TREE_CODE (TREE_TYPE (CONSTRUCTOR_ELT (arg0,
0)->value))
!= VECTOR_TYPE)
{
- vals = VEC_alloc (constructor_elt, gc, n);
+ vec_alloc (vals, n);
for (i = 0;
i < n && idx + i < CONSTRUCTOR_NELTS (arg0);
++i)
@@ -14347,15 +14349,15 @@ fold (tree expr)
&& TREE_CODE (op0) == CONSTRUCTOR
&& ! type_contains_placeholder_p (TREE_TYPE (op0)))
{
- VEC(constructor_elt,gc) *elts = CONSTRUCTOR_ELTS (op0);
- unsigned HOST_WIDE_INT end = VEC_length (constructor_elt, elts);
+ vec<constructor_elt, va_gc> *elts = CONSTRUCTOR_ELTS (op0);
+ unsigned HOST_WIDE_INT end = vec_safe_length (elts);
unsigned HOST_WIDE_INT begin = 0;
/* Find a matching index by means of a binary search. */
while (begin != end)
{
unsigned HOST_WIDE_INT middle = (begin + end) / 2;
- tree index = VEC_index (constructor_elt, elts, middle).index;
+ tree index = (*elts)[middle].index;
if (TREE_CODE (index) == INTEGER_CST
&& tree_int_cst_lt (index, op1))
@@ -14370,7 +14372,7 @@ fold (tree expr)
&& tree_int_cst_lt (op1, TREE_OPERAND (index, 0)))
end = middle;
else
- return VEC_index (constructor_elt, elts, middle).value;
+ return (*elts)[middle].value;
}
}