aboutsummaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-02-22 22:09:09 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2002-02-22 22:09:09 +0100
commit3256b817fc4df76420ab88b8f83dabeb66939360 (patch)
treea72c0063813e38c6c4dd851832a48761e804370e /gcc/stmt.c
parent9e0625a316b67773587f024b1d8d7814d9246876 (diff)
downloadgcc-3256b817fc4df76420ab88b8f83dabeb66939360.zip
gcc-3256b817fc4df76420ab88b8f83dabeb66939360.tar.gz
gcc-3256b817fc4df76420ab88b8f83dabeb66939360.tar.bz2
re PR c++/5748 (g++ dies with optimization)
PR c++/5748 * stmt.c (expand_anon_union_decl): Set TREE_USED on the anon union decl if any of elements was TREE_USED. * g++.dg/opt/anonunion1.C: New test. From-SVN: r49971
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 fc968bc..b41b62b 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);