+2014-05-05 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/60965
+ * ipa-devirt.c (get_class_context): Allow POD to change to non-POD.
+
2014-05-05 Radovan Obradovic <robradovic@mips.com>
Tom de Vries <tom@codesourcery.com>
context->outer_type = expected_type;
context->offset = 0;
context->maybe_derived_type = true;
+ context->maybe_in_construction = true;
+ /* POD can be changed to an instance of a polymorphic type by
+ placement new. Here we play safe and assume that any
+ non-polymorphic type is POD. */
+ if ((TREE_CODE (type) != RECORD_TYPE
+ || !TYPE_BINFO (type)
+ || !polymorphic_type_binfo_p (TYPE_BINFO (type)))
+ && (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
+ || (offset + tree_to_uhwi (TYPE_SIZE (expected_type)) <=
+ tree_to_uhwi (TYPE_SIZE (type)))))
+ return true;
return false;
}
+2014-05-05 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/60965
+ * g++.dg/ipa/devirt-32.C: New testcase.
+
2014-05-05 Richard Biener <rguenther@suse.de>
PR middle-end/61010
--- /dev/null
+/* { dg-options "-O2 -std=c++11 -fdump-ipa-inline" } */
+#include <new>
+
+class EmbeddedObject {
+public:
+ virtual int val() { return 2; }
+};
+
+class Container {
+ alignas(EmbeddedObject) char buffer[sizeof(EmbeddedObject)];
+public:
+ EmbeddedObject *obj() { return (EmbeddedObject*)buffer; }
+ Container() { new (buffer) EmbeddedObject(); }
+};
+
+Container o;
+
+int main()
+{
+ __builtin_printf("%d\n", o.obj()->val());
+}
+/* { dg-final { scan-ipa-dump-not "__builtin_unreachable" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */