aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-05-11 04:37:41 +0000
committerRichard Stallman <rms@gnu.org>1993-05-11 04:37:41 +0000
commite1fe03e98f0b3b141e38e06bce3f4aefbbe80b52 (patch)
tree03ee7ced121410929a3d34abc6314534b9cb88a8
parent02cd8797834423ef922e357d2f5437e6f8f44a12 (diff)
downloadgcc-e1fe03e98f0b3b141e38e06bce3f4aefbbe80b52.zip
gcc-e1fe03e98f0b3b141e38e06bce3f4aefbbe80b52.tar.gz
gcc-e1fe03e98f0b3b141e38e06bce3f4aefbbe80b52.tar.bz2
(complete_array_type): Call change_main_variant.
(complete_array_type): Make maxindex -1 for empty constructor. From-SVN: r4417
-rw-r--r--gcc/c-decl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index fa7d5bc..5fb9dd6 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3632,7 +3632,7 @@ complete_array_type (type, initial_value, do_default)
{
register int nelts
= list_length (CONSTRUCTOR_ELTS (initial_value));
- maxindex = build_int_2 (nelts - 1, 0);
+ maxindex = build_int_2 (nelts - 1, - (nelts == 0));
}
else
{
@@ -3654,9 +3654,13 @@ complete_array_type (type, initial_value, do_default)
if (maxindex)
{
+ tree main;
TYPE_DOMAIN (type) = build_index_type (maxindex);
if (!TREE_TYPE (maxindex))
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. */