aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2007-07-06 09:24:18 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2007-07-06 09:24:18 +0000
commitb5119fa1391d75ecd9c7e041151acb04bd6c7234 (patch)
tree55c0bb411246985213c916764c6073969a4f0d07 /gcc/cp/init.c
parent106b3d40e77897e85c6e041b88b74b8a3222417e (diff)
downloadgcc-b5119fa1391d75ecd9c7e041151acb04bd6c7234.zip
gcc-b5119fa1391d75ecd9c7e041151acb04bd6c7234.tar.gz
gcc-b5119fa1391d75ecd9c7e041151acb04bd6c7234.tar.bz2
c-common.c (boolean_increment): Use correctly typed constant.
2007-07-06 Richard Guenther <rguenther@suse.de> * c-common.c (boolean_increment): Use correctly typed constant. cp/ * init.c (build_new_1): Use the correct pointer type. * typeck2.c (build_m_component_ref): Likewise. From-SVN: r126405
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 288d0fa..b65de81 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1915,6 +1915,7 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
{
tree cookie;
tree cookie_ptr;
+ tree size_ptr_type;
/* Adjust so we're pointing to the start of the object. */
data_addr = get_target_expr (build2 (POINTER_PLUS_EXPR, full_pointer_type,
@@ -1924,8 +1925,9 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
many elements to destroy later. We use the last sizeof
(size_t) bytes to store the number of elements. */
cookie_ptr = fold_build1 (NEGATE_EXPR, sizetype, size_in_bytes (sizetype));
- cookie_ptr = build2 (POINTER_PLUS_EXPR, build_pointer_type (sizetype),
- data_addr, cookie_ptr);
+ size_ptr_type = build_pointer_type (sizetype);
+ cookie_ptr = build2 (POINTER_PLUS_EXPR, size_ptr_type,
+ fold_convert (size_ptr_type, data_addr), cookie_ptr);
cookie = build_indirect_ref (cookie_ptr, NULL);
cookie_expr = build2 (MODIFY_EXPR, sizetype, cookie, nelts);