Commit 2f145821 by Richard Stallman

(make_node, copy_node): Don't assume node length is multiple of int.

From-SVN: r2524
parent 71bde1f3
...@@ -877,11 +877,12 @@ make_node (code) ...@@ -877,11 +877,12 @@ make_node (code)
tree_node_sizes[(int)kind] += length; tree_node_sizes[(int)kind] += length;
#endif #endif
/* We assume here that the length of a tree node is a multiple of the /* Clear a word at a time. */
size of an int. Rounding up won't work because it would clobber
the next object. */
for (i = (length / sizeof (int)) - 1; i >= 0; i--) for (i = (length / sizeof (int)) - 1; i >= 0; i--)
((int *) t)[i] = 0; ((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); TREE_SET_CODE (t, code);
if (obstack == &permanent_obstack) if (obstack == &permanent_obstack)
...@@ -978,6 +979,9 @@ copy_node (node) ...@@ -978,6 +979,9 @@ copy_node (node)
for (i = (length / sizeof (int)) - 1; i >= 0; i--) for (i = (length / sizeof (int)) - 1; i >= 0; i--)
((int *) t)[i] = ((int *) node)[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; TREE_CHAIN (t) = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment