aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/rtti.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/rtti.c')
-rw-r--r--gcc/cp/rtti.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 53404b4..434b772 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -192,8 +192,7 @@ build_headof (tree exp)
type = cp_build_qualified_type (ptr_type_node,
cp_type_quals (TREE_TYPE (exp)));
- return build2 (POINTER_PLUS_EXPR, type, exp,
- convert_to_integer (sizetype, offset));
+ return fold_build_pointer_plus (exp, offset);
}
/* Get a bad_cast node for the program to throw...
@@ -918,8 +917,8 @@ tinfo_base_init (tinfo_s *ti, tree target)
vtable_ptr = cp_build_addr_expr (vtable_ptr, tf_warning_or_error);
/* We need to point into the middle of the vtable. */
- vtable_ptr = build2
- (POINTER_PLUS_EXPR, TREE_TYPE (vtable_ptr), vtable_ptr,
+ vtable_ptr = fold_build_pointer_plus
+ (vtable_ptr,
size_binop (MULT_EXPR,
size_int (2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE),
TYPE_SIZE_UNIT (vtable_entry_type)));