The following fixes PR69077. LTO bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard. 2016-01-12 Richard Biener <rguent...@suse.de> lto/ PR lto/69077 * lto-symtab.c (lto_symtab_prevailing_virtual_decl): Properly merge TREE_ADDRESSABLE and DECL_POSSIBLY_INLINED flags. * g++.dg/lto/pr69077_0.C: New testcase. * g++.dg/lto/pr69077_1.C: Likewise. Index: gcc/lto/lto-symtab.c =================================================================== *** gcc/lto/lto-symtab.c (revision 232261) --- gcc/lto/lto-symtab.c (working copy) *************** lto_symtab_prevailing_virtual_decl (tree *** 997,1002 **** --- 997,1014 ---- n = n->next_sharing_asm_name; if (n) { + /* Merge decl state in both directions, we may still end up using + the other decl. */ + TREE_ADDRESSABLE (n->decl) |= TREE_ADDRESSABLE (decl); + TREE_ADDRESSABLE (decl) |= TREE_ADDRESSABLE (n->decl); + + if (TREE_CODE (decl) == FUNCTION_DECL) + { + /* Merge decl state in both directions, we may still end up using + the other decl. */ + DECL_POSSIBLY_INLINED (n->decl) |= DECL_POSSIBLY_INLINED (decl); + DECL_POSSIBLY_INLINED (decl) |= DECL_POSSIBLY_INLINED (n->decl); + } lto_symtab_prevail_decl (n->decl, decl); decl = n->decl; } Index: gcc/testsuite/g++.dg/lto/pr69077_0.C =================================================================== *** gcc/testsuite/g++.dg/lto/pr69077_0.C (revision 0) --- gcc/testsuite/g++.dg/lto/pr69077_0.C (working copy) *************** *** 0 **** --- 1,14 ---- + // { dg-lto-do link } + // { dg-lto-options { { -O3 -g -flto } } } + // { dg-extra-ld-options "-r -nostdlib" } + + struct cStdDev + { + long ns; + virtual double mean() const { return ns; } + }; + + struct cWeightedStdDev : public cStdDev { + virtual int netPack(); + }; + int cWeightedStdDev::netPack() { } Index: gcc/testsuite/g++.dg/lto/pr69077_1.C =================================================================== *** gcc/testsuite/g++.dg/lto/pr69077_1.C (revision 0) --- gcc/testsuite/g++.dg/lto/pr69077_1.C (working copy) *************** *** 0 **** --- 1,15 ---- + struct cStdDev + { + long ns; + virtual double mean() const { return ns; } + }; + + struct sf + { + void recordScalar(double value); + cStdDev eedStats; + virtual void finish(); + }; + void sf::finish() { + recordScalar(eedStats.mean()); + }