Commit b2ec1738 by David Daney Committed by David Daney

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
parent dd735081
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> 2007-09-08 Jason Merrill <jason@redhat.com>
PR c++/33342 PR c++/33342
......
...@@ -1930,8 +1930,10 @@ build_new_1 (tree placement, tree type, tree nelts, tree init, ...@@ -1930,8 +1930,10 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
if (targetm.cxx.cookie_has_size ()) if (targetm.cxx.cookie_has_size ())
{ {
/* Also store the element size. */ /* Also store the element size. */
cookie_ptr = build2 (MINUS_EXPR, build_pointer_type (sizetype), cookie_ptr = build2 (POINTER_PLUS_EXPR, size_ptr_type, cookie_ptr,
cookie_ptr, size_in_bytes (sizetype)); fold_build1 (NEGATE_EXPR, sizetype,
size_in_bytes (sizetype)));
cookie = build_indirect_ref (cookie_ptr, NULL); cookie = build_indirect_ref (cookie_ptr, NULL);
cookie = build2 (MODIFY_EXPR, sizetype, cookie, cookie = build2 (MODIFY_EXPR, sizetype, cookie,
size_in_bytes(elt_type)); size_in_bytes(elt_type));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment