aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/rtti.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2006-11-13 23:28:25 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2006-11-13 23:28:25 +0000
commit07b183fda97ea74e5de935b4142834b58fb48fa7 (patch)
treeb2ff19cb54880cca1336dae1fe4c53e1edebf3c9 /gcc/cp/rtti.c
parentcb3d3842bb742467251c01f4b5d2a522becd2380 (diff)
downloadgcc-07b183fda97ea74e5de935b4142834b58fb48fa7.zip
gcc-07b183fda97ea74e5de935b4142834b58fb48fa7.tar.gz
gcc-07b183fda97ea74e5de935b4142834b58fb48fa7.tar.bz2
rtti.c (get_pseudo_ti_init): Ensure that the offset field of the base type info initializer has the correct type.
* rtti.c (get_pseudo_ti_init): Ensure that the offset field of the base type info initializer has the correct type. From-SVN: r118785
Diffstat (limited to 'gcc/cp/rtti.c')
-rw-r--r--gcc/cp/rtti.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 077d3e0..02272e8 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -1037,6 +1037,7 @@ get_pseudo_ti_init (tree type, unsigned tk_index)
tree binfo = TYPE_BINFO (type);
int nbases = BINFO_N_BASE_BINFOS (binfo);
VEC(tree,gc) *base_accesses = BINFO_BASE_ACCESSES (binfo);
+ tree offset_type = integer_types[itk_long];
tree base_inits = NULL_TREE;
int ix;
@@ -1059,17 +1060,17 @@ get_pseudo_ti_init (tree type, unsigned tk_index)
/* We store the vtable offset at which the virtual
base offset can be found. */
offset = BINFO_VPTR_FIELD (base_binfo);
- offset = convert (sizetype, offset);
flags |= 1;
}
else
offset = BINFO_OFFSET (base_binfo);
/* Combine offset and flags into one field. */
- offset = cp_build_binary_op (LSHIFT_EXPR, offset,
- build_int_cst (NULL_TREE, 8));
- offset = cp_build_binary_op (BIT_IOR_EXPR, offset,
- build_int_cst (NULL_TREE, flags));
+ offset = fold_convert (offset_type, offset);
+ offset = fold_build2 (LSHIFT_EXPR, offset_type, offset,
+ build_int_cst (offset_type, 8));
+ offset = fold_build2 (BIT_IOR_EXPR, offset_type, offset,
+ build_int_cst (offset_type, flags));
base_init = tree_cons (NULL_TREE, offset, base_init);
base_init = tree_cons (NULL_TREE, tinfo, base_init);
base_init = build_constructor_from_list (NULL_TREE, base_init);