aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorDavid Daney <ddaney@avtrex.com>2007-09-09 23:31:35 +0000
committerDavid Daney <daney@gcc.gnu.org>2007-09-09 23:31:35 +0000
commitb2ec1738df672b44576efb62f57dabc381eef753 (patch)
tree9e68a01a7bc706a81ce7f19b40b1824f08e05a1f /gcc/cp
parentdd735081f0dd7285863033d59a1c550fee7b8599 (diff)
downloadgcc-b2ec1738df672b44576efb62f57dabc381eef753.zip
gcc-b2ec1738df672b44576efb62f57dabc381eef753.tar.gz
gcc-b2ec1738df672b44576efb62f57dabc381eef753.tar.bz2
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
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/init.c6
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));