diff options
author | Richard Stallman <rms@gnu.org> | 1993-09-13 20:17:48 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-09-13 20:17:48 +0000 |
commit | ecd4cee03c1299324409ee653b673e8acc84ec58 (patch) | |
tree | ad96adfc839223d690084041fa9969c6e4342a5f /gcc/c-decl.c | |
parent | 03dc44a6145f85805d12f902da4b1c2efb0a44cc (diff) | |
download | gcc-ecd4cee03c1299324409ee653b673e8acc84ec58.zip gcc-ecd4cee03c1299324409ee653b673e8acc84ec58.tar.gz gcc-ecd4cee03c1299324409ee653b673e8acc84ec58.tar.bz2 |
(complete_array_type): Handle TREE_PURPOSE of array constructor elements.
From-SVN: r5316
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 539828e..205d5ad 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3672,9 +3672,16 @@ complete_array_type (type, initial_value, do_default) } else if (TREE_CODE (initial_value) == CONSTRUCTOR) { - register int nelts - = list_length (CONSTRUCTOR_ELTS (initial_value)); - maxindex = build_int_2 (nelts - 1, - (nelts == 0)); + tree elts = CONSTRUCTOR_ELTS (initial_value); + maxindex = integer_zero_node; + for (; elts; elts = TREE_CHAIN (elts)) + { + if (TREE_PURPOSE (elts)) + maxindex = TREE_PURPOSE (elts); + else + maxindex = size_binop (PLUS_EXPR, maxindex, size_one_node); + } + maxindex = copy_node (maxindex); } else { |