search.c (my_tree_cons): Don't clear words outside the newly allocated node.
authorJeff Law <law@gcc.gnu.org>
Thu, 16 Apr 1998 16:48:43 +0000 (10:48 -0600)
committerJeff Law <law@gcc.gnu.org>
Thu, 16 Apr 1998 16:48:43 +0000 (10:48 -0600)
8
        * search.c (my_tree_cons): Don't clear words outside the
        newly allocated node.

From-SVN: r19238

gcc/cp/search.c

index 488220adc2abffb4fe55be20e6d7a5f167f0250b..4438372d79c1ce17d13368d17bba004774f89e93 100644 (file)
@@ -260,7 +260,10 @@ my_tree_cons (purpose, value, chain)
   tree p = (tree)obstack_alloc (&type_obstack_entries, sizeof (struct tree_list));
   ++my_tree_node_counter;
   TREE_TYPE (p) = NULL_TREE;
-  ((HOST_WIDE_INT *)p)[3] = 0;
+  /* The type of the last on the LHS of this statement must be a pointer
+     to the same type as the bitfields in struct tree_common.  Otherwise
+     we may write beyond our intended area.  */
+  ((unsigned *)p)[3] = 0;
   TREE_SET_CODE (p, TREE_LIST);
   TREE_PURPOSE (p) = purpose;
   TREE_VALUE (p) = value;