aboutsummaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index fc968bcbab3..b41b62bb8d0 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -4201,6 +4201,11 @@ expand_anon_union_decl (decl, cleanup, decl_elts)
tree cleanup_elt = TREE_PURPOSE (t);
enum machine_mode mode = TYPE_MODE (TREE_TYPE (decl_elt));
+ /* If any of the elements are addressable, so is the entire
+ union. */
+ if (TREE_USED (decl_elt))
+ TREE_USED (decl) = 1;
+
/* Propagate the union's alignment to the elements. */
DECL_ALIGN (decl_elt) = DECL_ALIGN (decl);
DECL_USER_ALIGN (decl_elt) = DECL_USER_ALIGN (decl);