Commit e1fe03e9 by Richard Stallman

(complete_array_type): Call change_main_variant.

(complete_array_type): Make maxindex -1 for empty constructor.

From-SVN: r4417
parent 02cd8797
...@@ -3632,7 +3632,7 @@ complete_array_type (type, initial_value, do_default) ...@@ -3632,7 +3632,7 @@ complete_array_type (type, initial_value, do_default)
{ {
register int nelts register int nelts
= list_length (CONSTRUCTOR_ELTS (initial_value)); = list_length (CONSTRUCTOR_ELTS (initial_value));
maxindex = build_int_2 (nelts - 1, 0); maxindex = build_int_2 (nelts - 1, - (nelts == 0));
} }
else else
{ {
...@@ -3654,9 +3654,13 @@ complete_array_type (type, initial_value, do_default) ...@@ -3654,9 +3654,13 @@ complete_array_type (type, initial_value, do_default)
if (maxindex) if (maxindex)
{ {
tree main;
TYPE_DOMAIN (type) = build_index_type (maxindex); TYPE_DOMAIN (type) = build_index_type (maxindex);
if (!TREE_TYPE (maxindex)) if (!TREE_TYPE (maxindex))
TREE_TYPE (maxindex) = TYPE_DOMAIN (type); TREE_TYPE (maxindex) = TYPE_DOMAIN (type);
change_main_variant (type,
build_array_type (TREE_TYPE (type),
TYPE_DOMAIN (type)));
} }
/* Lay out the type now that we can get the real answer. */ /* Lay out the type now that we can get the real answer. */
......
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