We add global register vars into the LTO symtab processed by the linker. That's of course bogus. Fixed with the following patch.
Bootstrap & regtest running on x86_64-unknown-linux-gnu. Richard. 2013-02-12 Richard Biener <rguent...@suse.de> PR lto/56297 * lto-streamer-out.c (write_symbol): Do not output symbols for hard register variables. * gcc.dg/lto/pr56297_0.c: New testcase. * gcc.dg/lto/pr56297_0.c: Likewise. Index: gcc/lto-streamer-out.c =================================================================== *** gcc/lto-streamer-out.c (revision 195973) --- gcc/lto-streamer-out.c (working copy) *************** write_symbol (struct streamer_tree_cache *** 1166,1172 **** if (!TREE_PUBLIC (t) || is_builtin_fn (t) || DECL_ABSTRACT (t) ! || TREE_CODE (t) == RESULT_DECL) return; gcc_assert (TREE_CODE (t) == VAR_DECL --- 1166,1173 ---- if (!TREE_PUBLIC (t) || is_builtin_fn (t) || DECL_ABSTRACT (t) ! || TREE_CODE (t) == RESULT_DECL ! || (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))) return; gcc_assert (TREE_CODE (t) == VAR_DECL Index: gcc/testsuite/gcc.dg/lto/pr56297_0.c =================================================================== *** gcc/testsuite/gcc.dg/lto/pr56297_0.c (revision 0) --- gcc/testsuite/gcc.dg/lto/pr56297_0.c (working copy) *************** *** 0 **** --- 1,13 ---- + /* { dg-lto-do link } */ + /* { dg-lto-options { { -flto -fno-common } } } */ + + #if __x86_64__ || __i386__ + register int i asm("esp"); + #else + extern int i; + #endif + + int main(void) + { + return i; + } Index: gcc/testsuite/gcc.dg/lto/pr56297_1.c =================================================================== *** gcc/testsuite/gcc.dg/lto/pr56297_1.c (revision 0) --- gcc/testsuite/gcc.dg/lto/pr56297_1.c (working copy) *************** *** 0 **** --- 1,5 ---- + #if __x86_64__ || __i386__ + register int i asm("esp"); + #else + int i; + #endif