}
else if (TREE_CODE (type) == ARRAY_TYPE)
{
- tree index;
tree max_index;
tree inits;
/* A zero-sized array, which is accepted as an extension, will
have an upper bound of -1. */
if (!tree_int_cst_equal (max_index, integer_minus_one_node))
- for (index = size_zero_node;
- !tree_int_cst_lt (max_index, index);
- index = size_binop (PLUS_EXPR, index, size_one_node))
- inits = tree_cons (index,
- build_zero_init (TREE_TYPE (type),
- /*nelts=*/NULL_TREE,
- static_storage_p),
- inits);
- CONSTRUCTOR_ELTS (init) = nreverse (inits);
+ {
+ tree elt_init = build_zero_init (TREE_TYPE (type),
+ /*nelts=*/NULL_TREE,
+ static_storage_p);
+ tree range = build (RANGE_EXPR,
+ sizetype, size_zero_node, max_index);
+
+ inits = tree_cons (range, elt_init, inits);
+ }
+
+ CONSTRUCTOR_ELTS (init) = nreverse (inits);
}
else if (TREE_CODE (type) == REFERENCE_TYPE)
;
+2004-12-09 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/16681
+ * g++.dg/init/array15.C: New.
+ * g++.dg/init/array16.C: New.
+
2004-11-29 Roger Sayle <roger@eyesopen.com>
PR rtl-optimization/9771