From: David Daney Date: Sun, 9 Sep 2007 23:31:35 +0000 (+0000) Subject: re PR c++/33324 (ICE on new array of objects with virtual destructors.) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b2ec1738df672b44576efb62f57dabc381eef753;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ad342b6e785..cdbffb1e070 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 1aa732c26b0..cafc7217107 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));