diff mbox

Clear visibility of TYPE_DECL

Message ID 20160226105025.GB94603@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Feb. 26, 2016, 10:50 a.m. UTC
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.

Comments

Richard Biener Feb. 26, 2016, 11:11 a.m. UTC | #1
On Fri, 26 Feb 2016, Jan Hubicka wrote:

> 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?

Ok.

Richard.

> 	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)
diff mbox

Patch

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)