re PR middle-end/42320 (link error with -flto (undefined reference to 'non-virtual thunk ...))

2009-12-11  Richard Guenther  <rguenther@suse.de>

	PR lto/42320
	* lto-symtab.c (lto_symtab_resolve_can_prevail_p): Properly
	detect non-prevailing decls.

	* g++.dg/lto/20091210-1_0.h: New testcase.
	* g++.dg/lto/20091210-1_0.C: Likewise.
	* g++.dg/lto/20091210-1_1.C: Likewise.

From-SVN: r155155
This commit is contained in:
Richard Guenther 2009-12-11 10:56:17 +00:00 committed by Richard Biener
parent f7dc4e3dc7
commit 5d96330ac8
6 changed files with 38 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2009-12-11 Richard Guenther <rguenther@suse.de>
PR lto/42320
* lto-symtab.c (lto_symtab_resolve_can_prevail_p): Properly
detect non-prevailing decls.
2009-12-10 Jakub Jelinek <jakub@redhat.com>
PR c++/42317

View file

@ -371,7 +371,10 @@ lto_symtab_resolve_replaceable_p (lto_symtab_entry_t e)
static bool
lto_symtab_resolve_can_prevail_p (lto_symtab_entry_t e)
{
if (!TREE_STATIC (e->decl))
/* The C++ frontend ends up neither setting TREE_STATIC nor
DECL_EXTERNAL on virtual methods but only TREE_PUBLIC.
So do not reject !TREE_STATIC here but only DECL_EXTERNAL. */
if (DECL_EXTERNAL (e->decl))
return false;
/* For functions we need a non-discarded body. */

View file

@ -1,3 +1,10 @@
2009-12-11 Richard Guenther <rguenther@suse.de>
PR lto/42320
* g++.dg/lto/20091210-1_0.h: New testcase.
* g++.dg/lto/20091210-1_0.C: Likewise.
* g++.dg/lto/20091210-1_1.C: Likewise.
2009-12-10 Jakub Jelinek <jakub@redhat.com>
PR c++/42317

View file

@ -0,0 +1,3 @@
// { dg-lto-do link }
#include "20091210-1_0.h"
void Base::f() {}

View file

@ -0,0 +1,9 @@
struct Base1 {
virtual ~Base1() {}
};
struct Base2 {
virtual void f() = 0;
};
struct Base : Base1, Base2 {
virtual void f();
};

View file

@ -0,0 +1,9 @@
#include "20091210-1_0.h"
struct Foo : Base {
virtual void g();
};
void Foo::g() {}
int main() {}