+2016-04-01 Jakub Jelinek <jakub@redhat.com>
+ Marek Polacek <polacek@redhat.com>
+
+ PR c++/70488
+ * init.c (warn_placement_new_too_small): Test whether
+ DECL_SIZE_UNIT or TYPE_SIZE_UNIT are integers that fit into uhwi.
+
2016-04-01 Nathan Sidwell <nathan@acm.org>
PR c++/68475
though the size of a member of a union may be viewed as extending
to the end of the union itself (it is by __builtin_object_size). */
if ((TREE_CODE (oper) == VAR_DECL || use_obj_size)
- && DECL_SIZE_UNIT (oper))
+ && DECL_SIZE_UNIT (oper)
+ && tree_fits_uhwi_p (DECL_SIZE_UNIT (oper)))
{
/* Use the size of the entire array object when the expression
refers to a variable or its size depends on an expression
bytes_avail = tree_to_uhwi (DECL_SIZE_UNIT (oper));
exact_size = !use_obj_size;
}
- else if (TYPE_SIZE_UNIT (TREE_TYPE (oper)))
+ else if (TYPE_SIZE_UNIT (TREE_TYPE (oper))
+ && tree_fits_uhwi_p (TYPE_SIZE_UNIT (TREE_TYPE (oper))))
{
/* Use the size of the type of the destination buffer object
as the optimistic estimate of the available space in it. */
+2016-04-01 Jakub Jelinek <jakub@redhat.com>
+ Marek Polacek <polacek@redhat.com>
+
+ PR c++/70488
+ * g++.dg/init/new47.C: New test.
+
2016-04-01 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR target/70496
--- /dev/null
+// PR c++/70448
+// { dg-do compile }
+// { dg-options "-Wall" }
+
+typedef __typeof__ (sizeof 0) size_t;
+void *operator new (size_t, void *p) { return p; }
+void *operator new[] (size_t, void *p) { return p; }
+struct S { size_t s; };
+void bar (S *);
+
+void
+foo (unsigned int s)
+{
+ char t[sizeof (S) + s];
+ S *f = new (t) S;
+ bar (f);
+ f = new (t) S[1];
+ bar (f);
+}