https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68811

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
The bug is that we can not prevail builtin decl refered by the global tables by
non-builtin.  The following restores the previous behaviour of not merging.
Next stage1 I can clean this up finally.
Index: lto-symtab.c
===================================================================
--- lto-symtab.c        (revision 231439)
+++ lto-symtab.c        (working copy)
@@ -514,11 +514,9 @@ lto_symtab_merge_p (tree prevailing, tre
     return false;
   if (TREE_CODE (prevailing) == FUNCTION_DECL)
     {
-      if (DECL_BUILT_IN (prevailing) != DECL_BUILT_IN (decl))
-       return false;
-      if (DECL_BUILT_IN (prevailing)
-         && (DECL_BUILT_IN_CLASS (prevailing) != DECL_BUILT_IN_CLASS (decl)
-             || DECL_FUNCTION_CODE (prevailing) != DECL_FUNCTION_CODE (decl)))
+      /* Never merge bulitin declarations. Those are streamed specially
+        and already merged from the corresponding tables.  */
+      if (DECL_BUILT_IN (prevailing) || DECL_BUILT_IN (decl))
        return false;
     }
   /* There are several other cases where merging can not be done, but until
@@ -709,7 +707,7 @@ lto_symtab_merge_decls_1 (symtab_node *f
                && lto_symtab_symbol_p (e))
              prevailing = e;
        }
-      /* For variables prefer the non-builtin if one is available.  */
+      /* For functions prefer the non-builtin if one is available.  */
       else if (TREE_CODE (prevailing->decl) == FUNCTION_DECL)
        {
          for (e = first; e; e = e->next_sharing_asm_name)

Reply via email to