aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-05-22 21:05:09 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-05-22 17:05:09 -0400
commit329745f7c1aa1eb0f5ad89a327b86c2d3293ebbe (patch)
treea97a48d256700e83b50986a714f0677fce3d6d11
parent697073d938614f9285bf9e9ffc5c53d657d9677e (diff)
downloadgcc-329745f7c1aa1eb0f5ad89a327b86c2d3293ebbe.zip
gcc-329745f7c1aa1eb0f5ad89a327b86c2d3293ebbe.tar.gz
gcc-329745f7c1aa1eb0f5ad89a327b86c2d3293ebbe.tar.bz2
class.c (build_vtable_entry): Use int_fits_type_p.
* class.c (build_vtable_entry): Use int_fits_type_p. (build_vtable): Pass a signed offset to build_vtable_entry. (prepare_fresh_vtable, modify_one_vtable, fixup_vtable_deltas1, set_rtti_entry): Likewise. From-SVN: r19964
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/class.c31
2 files changed, 21 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0c5ddc1..da95654 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+1998-05-22 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (build_vtable_entry): Use int_fits_type_p.
+ (build_vtable): Pass a signed offset to build_vtable_entry.
+ (prepare_fresh_vtable, modify_one_vtable, fixup_vtable_deltas1,
+ set_rtti_entry): Likewise.
+
1998-05-22 Per Bothner <bothner@cygnus.com>
* cp-tree.h: Add comments documenting which LANG_FLAGS are used.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 36eb589..ad4ff00 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -450,15 +450,11 @@ build_vtable_entry (delta, pfn)
build_expr_list (NULL_TREE, pfn)));
tree entry = build (CONSTRUCTOR, vtable_entry_type, NULL_TREE, elems);
- /* DELTA is constructed by `size_int', which means it may be an
- unsigned quantity on some platforms. Therefore, we cannot use
- `int_fits_type_p', because when DELTA is really negative,
- `force_fit_type' will make it look like a very large number. */
-
- if ((TREE_INT_CST_LOW (TYPE_MAX_VALUE (delta_type_node))
- < TREE_INT_CST_LOW (delta))
- || (TREE_INT_CST_LOW (delta)
- < TREE_INT_CST_LOW (TYPE_MIN_VALUE (delta_type_node))))
+ /* DELTA used to be constructed by `size_int' and/or size_binop,
+ which caused overflow problems when it was negative. That should
+ be fixed now. */
+
+ if (! int_fits_type_p (delta, delta_type_node))
{
if (flag_huge_objects)
sorry ("object size exceeds built-in limit for virtual function table implementation");
@@ -663,11 +659,11 @@ set_rtti_entry (virtuals, offset, type)
tree voff = build1 (NOP_EXPR, vfunc_ptr_type_node, offset);
TREE_CONSTANT (voff) = 1;
- TREE_VALUE (virtuals) = build_vtable_entry (size_zero_node, voff);
+ TREE_VALUE (virtuals) = build_vtable_entry (integer_zero_node, voff);
/* The second slot is for the tdesc pointer when thunks are used. */
TREE_VALUE (TREE_CHAIN (virtuals))
- = build_vtable_entry (size_zero_node, vfn);
+ = build_vtable_entry (integer_zero_node, vfn);
}
}
@@ -692,7 +688,7 @@ build_vtable (binfo, type)
/* Now do rtti stuff. */
offset = get_derived_offset (TYPE_BINFO (type), NULL_TREE);
- offset = size_binop (MINUS_EXPR, size_zero_node, offset);
+ offset = ssize_binop (MINUS_EXPR, integer_zero_node, offset);
set_rtti_entry (virtuals, offset, type);
}
else
@@ -884,7 +880,7 @@ prepare_fresh_vtable (binfo, for_type)
offset = BINFO_OFFSET (binfo);
set_rtti_entry (BINFO_VIRTUALS (binfo),
- size_binop (MINUS_EXPR, signed_size_zero_node, offset),
+ ssize_binop (MINUS_EXPR, integer_zero_node, offset),
for_type);
#ifdef GATHER_STATISTICS
@@ -2327,7 +2323,7 @@ modify_one_vtable (binfo, t, fndecl, pfn)
base_offset = size_binop (PLUS_EXPR,
get_derived_offset (binfo, DECL_CONTEXT (current_fndecl)),
BINFO_OFFSET (binfo));
- this_offset = size_binop (MINUS_EXPR, offset, base_offset);
+ this_offset = ssize_binop (MINUS_EXPR, offset, base_offset);
/* Make sure we can modify the derived association with immunity. */
if (TREE_USED (binfo))
@@ -2424,9 +2420,10 @@ fixup_vtable_deltas1 (binfo, t)
Also, we want just the delta between the most base class
that we derived this vfield from and us. */
base_offset = size_binop (PLUS_EXPR,
- get_derived_offset (binfo, DECL_CONTEXT (fndecl)),
+ get_derived_offset (binfo,
+ DECL_CONTEXT (fndecl)),
BINFO_OFFSET (binfo));
- this_offset = size_binop (MINUS_EXPR, offset, base_offset);
+ this_offset = ssize_binop (MINUS_EXPR, offset, base_offset);
if (! tree_int_cst_equal (this_offset, delta))
{
@@ -3986,7 +3983,7 @@ finish_struct_1 (t, warn_anon)
/* The first slot is for the rtti offset. */
pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals);
- set_rtti_entry (pending_virtuals, size_zero_node, t);
+ set_rtti_entry (pending_virtuals, integer_zero_node, t);
build_vtable (NULL_TREE, t);
}
else