aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@gcc.gnu.org>2014-12-15 03:41:41 +0000
committerJan Hubicka <hubicka@gcc.gnu.org>2014-12-15 03:41:41 +0000
commitbebecd51b6d2bb0f29423a582b0294183392e0d4 (patch)
tree5c599da445c4658615bd7d6ae1567f48487ceaa6 /gcc/tree.c
parent1bf7c3241444b26d2b89b7731de198a9139b7d4e (diff)
downloadgcc-bebecd51b6d2bb0f29423a582b0294183392e0d4.zip
gcc-bebecd51b6d2bb0f29423a582b0294183392e0d4.tar.gz
gcc-bebecd51b6d2bb0f29423a582b0294183392e0d4.tar.bz2
re PR lto/64043 (ICE (segfault) with LTO: in tree_check/tree.h:2758 get_binfo_at_offset/tree.c:11914)
PR lto/64043 * tree.c (virtual_method_call_p): Return false when OTR type has no BINFO. * g++.dg/lto/pr64043_0.C: New testcase. From-SVN: r218727
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 3a857c0..4fc3db0 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -11864,12 +11864,17 @@ virtual_method_call_p (tree target)
{
if (TREE_CODE (target) != OBJ_TYPE_REF)
return false;
- target = TREE_TYPE (target);
- gcc_checking_assert (TREE_CODE (target) == POINTER_TYPE);
- target = TREE_TYPE (target);
- if (TREE_CODE (target) == FUNCTION_TYPE)
+ tree t = TREE_TYPE (target);
+ gcc_checking_assert (TREE_CODE (t) == POINTER_TYPE);
+ t = TREE_TYPE (t);
+ if (TREE_CODE (t) == FUNCTION_TYPE)
+ return false;
+ gcc_checking_assert (TREE_CODE (t) == METHOD_TYPE);
+ /* If we do not have BINFO associated, it means that type was built
+ without devirtualization enabled. Do not consider this a virtual
+ call. */
+ if (!TYPE_BINFO (obj_type_ref_class (target)))
return false;
- gcc_checking_assert (TREE_CODE (target) == METHOD_TYPE);
return true;
}