(make_node, copy_node): Don't assume node length is multiple of int.
authorRichard Stallman <rms@gnu.org>
Tue, 20 Oct 1992 08:57:43 +0000 (08:57 +0000)
committerRichard Stallman <rms@gnu.org>
Tue, 20 Oct 1992 08:57:43 +0000 (08:57 +0000)
From-SVN: r2524

gcc/tree.c

index 4fb48e6780b44be32c7126ab16c10774c82e802d..142254489a681b038e2446b4191137f87921d76b 100644 (file)
@@ -877,11 +877,12 @@ make_node (code)
   tree_node_sizes[(int)kind] += length;
 #endif
 
-  /* We assume here that the length of a tree node is a multiple of the
-     size of an int.  Rounding up won't work because it would clobber
-     the next object.  */
+  /* Clear a word at a time.  */
   for (i = (length / sizeof (int)) - 1; i >= 0; i--)
     ((int *) t)[i] = 0;
+  /* Clear any extra bytes.  */
+  for (i = length / sizeof (int) * sizeof (int); i < length; i++)
+    ((char *) t)[i] = 0;
 
   TREE_SET_CODE (t, code);
   if (obstack == &permanent_obstack)
@@ -978,6 +979,9 @@ copy_node (node)
 
   for (i = (length / sizeof (int)) - 1; i >= 0; i--)
     ((int *) t)[i] = ((int *) node)[i];
+  /* Clear any extra bytes.  */
+  for (i = length / sizeof (int) * sizeof (int); i < length; i++)
+    ((char *) t)[i] = 0;
 
   TREE_CHAIN (t) = 0;