+2002-10-12 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * tree.c (tree_size): Revise expressions using TREE_CODE_LENGTH and
+ TREE_VEC_LENGTH to ensure values are promoted before doing subtraction.
+
2002-10-11 Janis Johnson <janis187@us.ibm.com>
* doc/compat.texi: Add info about C++ libraries.
case '1': /* a unary arithmetic expression */
case '2': /* a binary arithmetic expression */
return (sizeof (struct tree_exp)
- + (TREE_CODE_LENGTH (code) - 1) * sizeof (char *));
+ + TREE_CODE_LENGTH (code) * sizeof (char *) - sizeof (char *));
case 'c': /* a constant */
/* We can't use TREE_CODE_LENGTH for INTEGER_CST, since the number of
case 'x': /* something random, like an identifier. */
{
- size_t length;
- length = (sizeof (struct tree_common)
- + TREE_CODE_LENGTH (code) * sizeof (char *));
- if (code == TREE_VEC)
- length += (TREE_VEC_LENGTH (node) - 1) * sizeof (char *);
- return length;
+ size_t length;
+ length = (sizeof (struct tree_common)
+ + TREE_CODE_LENGTH (code) * sizeof (char *));
+ if (code == TREE_VEC)
+ length += TREE_VEC_LENGTH (node) * sizeof (char *) - sizeof (char *);
+ return length;
}
default: