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
This commit is contained in:
Jan Hubicka 2014-12-15 03:41:41 +00:00
parent 1bf7c32414
commit bebecd51b6
4 changed files with 40 additions and 6 deletions

View File

@ -1,4 +1,14 @@
2014-12-14 Jan HUbicka <hubicka@ucw.cz>
2014-12-14 Jan Hubicka <hubicka@ucw.cz>
* cgraphunit.c (analyze_functions): Always analyze targets of aliases.
2014-12-14 Jan Hubicka <hubicka@ucw.cz>
PR lto/64043
* tree.c (virtual_method_call_p): Return false when OTR type has
no BINFO.
2014-12-14 Jan Hubicka <hubicka@ucw.cz>
* cgraphunit.c (analyze_functions): Do not analyze extern inline
funtions when not optimizing; skip comdat locals.

View File

@ -1,3 +1,8 @@
2014-12-14 Jan HUbicka <hubicka@ucw.cz>
PR lto/64043
* g++.dg/lto/pr64043_0.C: New testcase.
2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
PR rtl-optimization/64037

View File

@ -0,0 +1,14 @@
// { dg-lto-do link }
// { dg-lto-options { { -flto -std=c++11 } } }
// { dg-extra-ld-options "-r -nostdlib -O2" }
class Validator
{
public:
virtual ~Validator ();
};
class FooWriter
{
Validator *validator;
~FooWriter ();
};
FooWriter::~FooWriter () { delete validator; }

View File

@ -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;
}