I'm testing the following to avoid ICEing when using LTO and mismatched -g vs. -g0 during compile/link phase by not conditionally clearing things in free_lang_data_in_decl. (Similar code is in free_lang_data_in_type, but without a testcase I don't want to remove it)
LTO bootstrap and regtest running on x86_64-unknown-linux-gnu. Richard. 2011-12-09 Richard Guenther <rguent...@suse.de> PR lto/48042 * tree.c (free_lang_data_in_decl): Remove freeing conditional on debuginfo level. * g++.dg/lto/pr48042_0.C: New testcase. Index: gcc/tree.c =================================================================== --- gcc/tree.c (revision 182154) +++ gcc/tree.c (working copy) @@ -4600,11 +4591,6 @@ free_lang_data_in_decl (tree decl) if (TREE_CODE (decl) == FIELD_DECL) free_lang_data_in_one_sizepos (&DECL_FIELD_OFFSET (decl)); - /* DECL_FCONTEXT is only used for debug info generation. */ - if (TREE_CODE (decl) == FIELD_DECL - && debug_info_level < DINFO_LEVEL_TERSE) - DECL_FCONTEXT (decl) = NULL_TREE; - if (TREE_CODE (decl) == FUNCTION_DECL) { if (gimple_has_body_p (decl)) Index: gcc/testsuite/g++.dg/lto/pr48042_0.C =================================================================== --- gcc/testsuite/g++.dg/lto/pr48042_0.C (revision 0) +++ gcc/testsuite/g++.dg/lto/pr48042_0.C (revision 0) @@ -0,0 +1,14 @@ +// { dg-lto-do link } +// { dg-extra-ld-options "-r -nostdlib -g" } + +class A { + virtual int x() = 0; +}; + +class B:public A { + int x(); +}; + +int B::x() { +} +