diff options
author | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-01-17 15:11:00 +0000 |
---|---|---|
committer | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-01-17 15:11:00 +0000 |
commit | 2b62583df62fb887175a04183ae954fb3348a4d3 (patch) | |
tree | aa831e6b8e4dbe3d5b87f14a88d0c7462426950d /gcc/ipa-polymorphic-call.c | |
parent | 8313400609fd2961ac48b1413cd68f5d06ea4924 (diff) | |
download | gcc-2b62583df62fb887175a04183ae954fb3348a4d3.tar.gz |
Fix wrong assumption in contains_type_p (PR ipa/71207).
2017-01-17 Martin Liska <mliska@suse.cz>
PR ipa/71207
* g++.dg/ipa/pr71207.C: New test.
2017-01-17 Martin Liska <mliska@suse.cz>
PR ipa/71207
* ipa-polymorphic-call.c (contains_type_p): Fix wrong
assumption and add comment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244530 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-polymorphic-call.c')
-rw-r--r-- | gcc/ipa-polymorphic-call.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c index da64ce4c6e0..e690d05158d 100644 --- a/gcc/ipa-polymorphic-call.c +++ b/gcc/ipa-polymorphic-call.c @@ -463,12 +463,12 @@ contains_type_p (tree outer_type, HOST_WIDE_INT offset, /* Check that type is within range. */ if (offset < 0) return false; - if (TYPE_SIZE (outer_type) && TYPE_SIZE (otr_type) - && TREE_CODE (TYPE_SIZE (outer_type)) == INTEGER_CST - && TREE_CODE (TYPE_SIZE (otr_type)) == INTEGER_CST - && wi::ltu_p (wi::to_offset (TYPE_SIZE (outer_type)), - (wi::to_offset (TYPE_SIZE (otr_type)) + offset))) - return false; + + /* PR ipa/71207 + As OUTER_TYPE can be a type which has a diamond virtual inheritance, + it's not necessary that INNER_TYPE will fit within OUTER_TYPE with + a given offset. It can happen that INNER_TYPE also contains a base object, + however it would point to the same instance in the OUTER_TYPE. */ context.offset = offset; context.outer_type = TYPE_MAIN_VARIANT (outer_type); |