diff options
author | Richard Henderson <rth@redhat.com> | 2005-01-26 07:20:53 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2005-01-26 07:20:53 -0800 |
commit | 6f642f985272e36ec5bac248a65e912605727337 (patch) | |
tree | 2bf5d70375fa0bc54fd1069c76adcd376923ad97 /gcc/gimplify.c | |
parent | ead553a1d9f9206c1f5a3b1a6799ea877fc9a845 (diff) | |
download | gcc-6f642f985272e36ec5bac248a65e912605727337.zip gcc-6f642f985272e36ec5bac248a65e912605727337.tar.gz gcc-6f642f985272e36ec5bac248a65e912605727337.tar.bz2 |
re PR middle-end/19515 (Violation of C99 6.7.8 ยง21 for unions)
PR middle-end/19515
* expr.c (categorize_ctor_elements): New argument p_must_clear.
(categorize_ctor_elements_1): Likewise. Detect a union that isn't
fully initialized.
(mostly_zeros_p): Update for new categorize_ctor_elements argument.
* gimplify.c (gimplify_init_constructor): Likewise. Only shove
objects into static storage if they have more than one non-zero value.
* tree.h (categorize_ctor_elements): Update decl.
From-SVN: r94266
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index d77a3b3..ac9ae14 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2599,11 +2599,12 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p, categorize_ctor_elements (ctor, &num_nonzero_elements, &num_nonconstant_elements, - &num_ctor_elements); + &num_ctor_elements, &cleared); /* If a const aggregate variable is being initialized, then it should never be a lose to promote the variable to be static. */ if (num_nonconstant_elements == 0 + && num_nonzero_elements > 1 && TREE_READONLY (object) && TREE_CODE (object) == VAR_DECL) { @@ -2685,7 +2686,6 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p, num_type_elements = count_type_elements (TREE_TYPE (ctor)); /* If there are "lots" of zeros, then block clear the object first. */ - cleared = false; if (num_type_elements - num_nonzero_elements > CLEAR_RATIO && num_nonzero_elements < num_type_elements/4) cleared = true; |