diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2014-05-06 01:27:40 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2014-05-05 23:27:40 +0000 |
commit | e400f0815936f54b1993e6ea64316327baa75253 (patch) | |
tree | d33b6cc729efd20b1314e56cca509a2cbe6c85a9 /gcc/ipa-devirt.c | |
parent | aaeaa9a91c6166d095b0b128315290b538080fac (diff) | |
download | gcc-e400f0815936f54b1993e6ea64316327baa75253.zip gcc-e400f0815936f54b1993e6ea64316327baa75253.tar.gz gcc-e400f0815936f54b1993e6ea64316327baa75253.tar.bz2 |
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
Diffstat (limited to 'gcc/ipa-devirt.c')
-rw-r--r-- | gcc/ipa-devirt.c | 11 |
1 files changed, 11 insertions, 0 deletions
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; } |