Commit 6b6c8106 by Steven Bosscher Committed by Steven Bosscher

init.c (build_zero_init): max_index is the number of elements, minus 1.

	* init.c (build_zero_init): max_index is the number of
	elements, minus 1.

From-SVN: r92323
parent b9e1e14b
2004-12-17 Steven Bosscher <stevenb@suse.de>
* init.c (build_zero_init): max_index is the number of
elements, minus 1.
2004-12-17 Nathan Sidwell <nathan@codesourcery.com>
PR c++/18721
......
......@@ -221,7 +221,11 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
init = build_constructor (type, NULL_TREE);
/* Iterate over the array elements, building initializations. */
inits = NULL_TREE;
max_index = nelts ? nelts : array_type_nelts (type);
if (nelts)
max_index = fold (build2 (MINUS_EXPR, TREE_TYPE (nelts),
nelts, integer_one_node));
else
max_index = array_type_nelts (type);
gcc_assert (TREE_CODE (max_index) == INTEGER_CST);
/* A zero-sized array, which is accepted as an extension, will
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment