aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Bothner <bothner@gcc.gnu.org>1996-04-23 13:01:58 -0700
committerPer Bothner <bothner@gcc.gnu.org>1996-04-23 13:01:58 -0700
commit8e958f701f160e5eb907f84842ade7696ec4a7de (patch)
treebdb71e81003fd9d44a1ea1e9e75baa09a421101c
parent8b8821d52dc73c3f4a8e8d09fed95ff2037156a8 (diff)
downloadgcc-8e958f701f160e5eb907f84842ade7696ec4a7de.zip
gcc-8e958f701f160e5eb907f84842ade7696ec4a7de.tar.gz
gcc-8e958f701f160e5eb907f84842ade7696ec4a7de.tar.bz2
* expr.c (store_constructor): Fix test for missing array elements.
From-SVN: r11869
-rw-r--r--gcc/expr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index f539b49..278cfb3 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -3488,7 +3488,10 @@ store_constructor (exp, target, cleared)
if (mostly_zeros_p (TREE_VALUE (elt)))
zero_count += this_node_count;
}
- if (4 * zero_count >= 3 * count)
+ /* Clear the entire array first if there are any missing elements,
+ or if the incidence of zero elements is >= 75%. */
+ if (count < maxelt - minelt + 1
+ || 4 * zero_count >= 3 * count)
need_to_clear = 1;
}
if (need_to_clear)