[LTO][PATCH] Fix lto1 assertion error on global register decl

Simon Baldwin simonb@google.com
Thu Dec 4 12:27:00 GMT 2008


This patch fixes a compiler error that occurs in lto1 when a global register
variable is used.  Compilation fails in lto1 with "lto1: internal compiler
error: in lto_symtab_merge_decl, at lto-symtab.c:707".

The patch disables the failing gcc_assert().


gcc/ChangeLog.lto
2008-12-04  Simon Baldwin  <simonb@google.com>

	* lto-symtab.c (lto_symtab_merge_decl): Disable assertion that
	tests for non-local register variables.

gcc/testsuite/ChangeLog.lto
2008-12-04  Simon Baldwin  <simonb@google.com>

	* gcc.dg/lto/20081204-2_0: New.


Index: gcc/lto-symtab.c
===================================================================
--- gcc/lto-symtab.c	(revision 142434)
+++ gcc/lto-symtab.c	(working copy)
@@ -704,7 +704,9 @@ lto_symtab_merge_decl (tree new_decl,
   /*gcc_assert (!DECL_NONLOCAL (new_decl));*/
   if (TREE_CODE (new_decl) == VAR_DECL)
     {
-      gcc_assert (!DECL_REGISTER (new_decl));
+      /* FIXME lto: gcc supports global register variables, so this
+	 assertion may fail incorrectly.  */
+      /*gcc_assert (!DECL_REGISTER (new_decl));*/
       gcc_assert (!(DECL_EXTERNAL (new_decl) && DECL_INITIAL (new_decl)));
     }
 
Index: gcc/testsuite/gcc.dg/lto/20081204-2_0.c
===================================================================
--- gcc/testsuite/gcc.dg/lto/20081204-2_0.c	(revision 0)
+++ gcc/testsuite/gcc.dg/lto/20081204-2_0.c	(revision 0)
@@ -0,0 +1,4 @@
+/* { dg-do link { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "{-flto-single -shared}" } */
+
+register int ri asm("edi");



More information about the Gcc-patches mailing list