From e1fe03e98f0b3b141e38e06bce3f4aefbbe80b52 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Tue, 11 May 1993 04:37:41 +0000 Subject: [PATCH] (complete_array_type): Call change_main_variant. (complete_array_type): Make maxindex -1 for empty constructor. From-SVN: r4417 --- gcc/c-decl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index fa7d5bc567e..5fb9dd60510 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. */ -- 2.30.2