summaryrefslogtreecommitdiff
path: root/gcc/cp/init.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/init.cc')
-rw-r--r--gcc/cp/init.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc
index c20ed211f1d..75ab965a218 100644
--- a/gcc/cp/init.cc
+++ b/gcc/cp/init.cc
@@ -1066,7 +1066,7 @@ perform_member_init (tree member, tree init, hash_set<tree> &uninitialized)
init = build2 (INIT_EXPR, type, decl, init);
finish_expr_stmt (init);
FOR_EACH_VEC_ELT (*cleanups, i, t)
- push_cleanup (decl, t, false);
+ push_cleanup (NULL_TREE, t, false);
}
else if (type_build_ctor_call (type)
|| (init && CLASS_TYPE_P (strip_array_types (type))))
@@ -2811,6 +2811,11 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper)
if (!objsize)
return;
+ /* We can only draw conclusions if ref.deref == -1,
+ i.e. oper is the address of the object. */
+ if (ref.deref != -1)
+ return;
+
offset_int bytes_avail = wi::to_offset (objsize);
offset_int bytes_need;
@@ -3287,7 +3292,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
{
unsigned align = TYPE_ALIGN_UNIT (elt_type);
/* Also consider the alignment of the cookie, if any. */
- if (TYPE_VEC_NEW_USES_COOKIE (elt_type))
+ if (array_p && TYPE_VEC_NEW_USES_COOKIE (elt_type))
align = MAX (align, TYPE_ALIGN_UNIT (size_type_node));
align_arg = build_int_cst (align_type_node, align);
}