aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>1999-12-24 17:27:36 +0000
committerRichard Kenner <kenner@gcc.gnu.org>1999-12-24 12:27:36 -0500
commit9376fcd631f21656c9544b5a9355f31618b2d63a (patch)
tree193ee7989a8a569cd6fffa4bbeec5515ae7296fc /gcc/expr.c
parent272df862c2e34f440ea28c96e0ebe89e1fad160c (diff)
downloadgcc-9376fcd631f21656c9544b5a9355f31618b2d63a.zip
gcc-9376fcd631f21656c9544b5a9355f31618b2d63a.tar.gz
gcc-9376fcd631f21656c9544b5a9355f31618b2d63a.tar.bz2
expr.c (store_constructor): Don't call clear_storage if size is variable.
* expr.c (store_constructor): Don't call clear_storage if size is variable. From-SVN: r31086
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 2290b98..ac498a4 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4151,9 +4151,10 @@ store_constructor (exp, target, align, cleared, size)
/* If the constructor has fewer fields than the structure
or if we are initializing the structure to mostly zeros,
clear the whole structure first. */
- else if ((list_length (CONSTRUCTOR_ELTS (exp))
- != list_length (TYPE_FIELDS (type)))
- || mostly_zeros_p (exp))
+ else if (size > 0
+ && ((list_length (CONSTRUCTOR_ELTS (exp))
+ != list_length (TYPE_FIELDS (type)))
+ || mostly_zeros_p (exp)))
{
if (! cleared)
clear_storage (target, GEN_INT (size),
@@ -4339,7 +4340,7 @@ store_constructor (exp, target, align, cleared, size)
|| 4 * zero_count >= 3 * count)
need_to_clear = 1;
}
- if (need_to_clear)
+ if (need_to_clear && size > 0)
{
if (! cleared)
clear_storage (target, GEN_INT (size),
@@ -4519,7 +4520,7 @@ store_constructor (exp, target, align, cleared, size)
bzero/memset), and set the bits we want. */
/* Check for all zeros. */
- if (elt == NULL_TREE)
+ if (elt == NULL_TREE && size > 0)
{
if (!cleared)
clear_storage (target, GEN_INT (size),