aboutsummaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-10-04 23:18:09 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-10-04 23:18:09 +0000
commit8a693bd0bbd4a31a457cbd1a8692eeed60c1fb32 (patch)
treecaa4d91eb575c61613e3e99ae95c86c8600f14ba /gcc/stmt.c
parent436c94cb55eb00f2120e95963538331a2469fd6a (diff)
downloadgcc-8a693bd0bbd4a31a457cbd1a8692eeed60c1fb32.zip
gcc-8a693bd0bbd4a31a457cbd1a8692eeed60c1fb32.tar.gz
gcc-8a693bd0bbd4a31a457cbd1a8692eeed60c1fb32.tar.bz2
stmt.c (expand_anon_union_decl): When any of the elements of the union is addressable, so is the entire union.
* stmt.c (expand_anon_union_decl): When any of the elements of the union is addressable, so is the entire union. From-SVN: r29816
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 9d67502..4e5a7a8 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -4162,15 +4162,25 @@ expand_anon_union_decl (decl, cleanup, decl_elts)
{
struct nesting *thisblock = current_function == 0 ? 0 : block_stack;
rtx x;
+ tree t;
+ /* If any of the elements are addressable, so is the entire union. */
+ for (t = decl_elts; t; t = TREE_CHAIN (t))
+ if (TREE_ADDRESSABLE (TREE_VALUE (t)))
+ {
+ TREE_ADDRESSABLE (decl) = 1;
+ break;
+ }
+
expand_decl (decl);
expand_decl_cleanup (decl, cleanup);
x = DECL_RTL (decl);
- while (decl_elts)
+ /* Go through the elements, assigning RTL to each. */
+ for (t = decl_elts; t; t = TREE_CHAIN (t))
{
- tree decl_elt = TREE_VALUE (decl_elts);
- tree cleanup_elt = TREE_PURPOSE (decl_elts);
+ tree decl_elt = TREE_VALUE (t);
+ tree cleanup_elt = TREE_PURPOSE (t);
enum machine_mode mode = TYPE_MODE (TREE_TYPE (decl_elt));
/* Propagate the union's alignment to the elements. */
@@ -4213,8 +4223,6 @@ expand_anon_union_decl (decl, cleanup, decl_elts)
thisblock->data.block.cleanups
= temp_tree_cons (decl_elt, cleanup_elt,
thisblock->data.block.cleanups);
-
- decl_elts = TREE_CHAIN (decl_elts);
}
}