From e400f0815936f54b1993e6ea64316327baa75253 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Tue, 6 May 2014 01:27:40 +0200 Subject: re PR ipa/60965 (IPA: Devirtualization versus placement new) PR ipa/60965 * ipa-devirt.c (get_class_context): Allow POD to change to non-POD. * g++.dg/ipa/devirt-32.C: New testcase. From-SVN: r210086 --- gcc/ipa-devirt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gcc/ipa-devirt.c') diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 4ff31fc..5cd4c83 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -1137,6 +1137,17 @@ give_up: 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; } -- cgit v1.1