diff options
Diffstat (limited to 'gcc/expr.c')
| -rw-r--r-- | gcc/expr.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index 79e651fc7f6..e2460203045 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -4073,7 +4073,14 @@ store_constructor (exp, target, align, cleared) /* Inform later passes that the whole union value is dead. */ if (TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == QUAL_UNION_TYPE) - emit_insn (gen_rtx_CLOBBER (VOIDmode, target)); + { + emit_insn (gen_rtx_CLOBBER (VOIDmode, target)); + + /* If the constructor is empty, clear the union. */ + if (! CONSTRUCTOR_ELTS (exp) && ! cleared) + clear_storage (target, expr_size (exp), + TYPE_ALIGN (type) / BITS_PER_UNIT); + } /* If we are building a static constructor into a register, set the initial value as zero so we can fold the value into |

