OSDN Git Service

* stmt.c (expand_anon_union_decl): When any of the elements of the
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Oct 1999 23:18:09 +0000 (23:18 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Oct 1999 23:18:09 +0000 (23:18 +0000)
union is addressable, so is the entire union.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29816 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/stmt.c

index 71c02a8..a03ab5d 100644 (file)
@@ -1,3 +1,8 @@
+Mon Oct  4 16:22:20 1999  Mark Mitchell  <mark@codesourcery.com>
+
+       * stmt.c (expand_anon_union_decl): When any of the elements of the
+       union is addressable, so is the entire union.
+
 Mon Oct  4 11:38:33 1999  Richard Henderson  <rth@cygnus.com>
 
        * sbitmap.c (sbitmap_ones): Don't set too many bits.
index 9d67502..4e5a7a8 100644 (file)
@@ -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);
     }
 }
 \f