Hi,
while looking into PR69589 I noticed that types are not merged when pragma
visibility does not match. This is because C++ FE stores visibility into 
TYPE_DECL
that is used by FE only.  This patch clears the flag in free_lang_data.

Bootstrapped/regtested x86_64-linux and tested it makes no difference for
Firefox LTO binary, OK?

        PR lto/69589
        * tree.c (free_lang_data_in_decl): Clear visibility of TYPE_DECL.
Index: tree.c
===================================================================
--- tree.c      (revision 233707)
+++ tree.c      (working copy)
@@ -5472,8 +5473,13 @@ free_lang_data_in_decl (tree decl)
          || (decl_function_context (decl) && !TREE_STATIC (decl)))
        DECL_INITIAL (decl) = NULL_TREE;
     }
-  else if (TREE_CODE (decl) == TYPE_DECL
-          || TREE_CODE (decl) == FIELD_DECL)
+  else if (TREE_CODE (decl) == TYPE_DECL)
+    {
+      DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
+      DECL_VISIBILITY_SPECIFIED (decl) = 0;
+      DECL_INITIAL (decl) = NULL_TREE;
+    }
+  else if (TREE_CODE (decl) == FIELD_DECL)
     DECL_INITIAL (decl) = NULL_TREE;
   else if (TREE_CODE (decl) == TRANSLATION_UNIT_DECL
            && DECL_INITIAL (decl)

Reply via email to