diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/init.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ad342b6..cdbffb1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2007-09-09 David Daney <ddaney@avtrex.com> + + PR c++/33324 + * init.c (build_new_1): Use POINTER_PLUS_EXPR instead of MINUS_EXPR + to calculate cookie_ptr. + 2007-09-08 Jason Merrill <jason@redhat.com> PR c++/33342 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 1aa732c..cafc721 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1930,8 +1930,10 @@ build_new_1 (tree placement, tree type, tree nelts, tree init, if (targetm.cxx.cookie_has_size ()) { /* Also store the element size. */ - cookie_ptr = build2 (MINUS_EXPR, build_pointer_type (sizetype), - cookie_ptr, size_in_bytes (sizetype)); + cookie_ptr = build2 (POINTER_PLUS_EXPR, size_ptr_type, cookie_ptr, + fold_build1 (NEGATE_EXPR, sizetype, + size_in_bytes (sizetype))); + cookie = build_indirect_ref (cookie_ptr, NULL); cookie = build2 (MODIFY_EXPR, sizetype, cookie, size_in_bytes(elt_type)); |