aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/ipa-devirt.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/ipa-devirt.c')
-rw-r--r--gcc-4.9/gcc/ipa-devirt.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/ipa-devirt.c b/gcc-4.9/gcc/ipa-devirt.c
index 03a6c5b5d..7f07d2f94 100644
--- a/gcc-4.9/gcc/ipa-devirt.c
+++ b/gcc-4.9/gcc/ipa-devirt.c
@@ -987,6 +987,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;
}