From b2ec1738df672b44576efb62f57dabc381eef753 Mon Sep 17 00:00:00 2001 From: David Daney Date: Sun, 9 Sep 2007 23:31:35 +0000 Subject: re PR c++/33324 (ICE on new array of objects with virtual destructors.) PR c++/33324 * init.c (build_new_1): Use POINTER_PLUS_EXPR instead of MINUS_EXPR to calculate cookie_ptr. From-SVN: r128312 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/init.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'gcc/cp') 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 + + 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 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)); -- cgit v1.1