pr 63325 - make fold ignore decl_with_vis.symtab_node
diff mbox

Message ID 1421924526-20666-1-git-send-email-tbsaunde+gcc@tbsaunde.org
State New
Headers show

Commit Message

tbsaunde+gcc@tbsaunde.org Jan. 22, 2015, 11:02 a.m. UTC
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

Hi,

fold calls symtab_node::get_create () which can change this field from NULL to
point to a new object.  It doesn't seem to really matter when the object gets
created and I don't think it changes any properties of the tree object.  So I
think it makes sense to do here what we do for similar members and leave it out
of the checksum.

bootstrapped + regtested x86_64-linux-gnu, ok?

Trev

gcc/

	* fold-const.c (fold_checksum_tree): Don't include
	expr.decl_with_vis.symtab_node in the checksum.

Comments

Jakub Jelinek Jan. 22, 2015, 11:06 a.m. UTC | #1
On Thu, Jan 22, 2015 at 06:02:06AM -0500, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> 
> Hi,
> 
> fold calls symtab_node::get_create () which can change this field from NULL to
> point to a new object.  It doesn't seem to really matter when the object gets
> created and I don't think it changes any properties of the tree object.  So I
> think it makes sense to do here what we do for similar members and leave it out
> of the checksum.
> 
> bootstrapped + regtested x86_64-linux-gnu, ok?
> 
> Trev
> 
> gcc/
> 
> 	* fold-const.c (fold_checksum_tree): Don't include
> 	expr.decl_with_vis.symtab_node in the checksum.

Ok, thanks.

> --- a/gcc/fold-const.c
> +++ b/gcc/fold-const.c
> @@ -14065,11 +14065,12 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
>    *slot = expr;
>    code = TREE_CODE (expr);
>    if (TREE_CODE_CLASS (code) == tcc_declaration
> -      && DECL_ASSEMBLER_NAME_SET_P (expr))
> +      && HAS_DECL_ASSEMBLER_NAME_P (expr))
>      {
> -      /* Allow DECL_ASSEMBLER_NAME to be modified.  */
> +      /* Allow DECL_ASSEMBLER_NAME and symtab_node to be modified.  */
>        memcpy ((char *) &buf, expr, tree_size (expr));
>        SET_DECL_ASSEMBLER_NAME ((tree)&buf, NULL);
> +      buf.decl_with_vis.symtab_node = NULL;

Wonder why we don't have an accessor macro for this in tree.h.
decl_with_vis is implementation detail.

	Jakub

Patch
diff mbox

diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index b1cbfac..88aa20e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -14065,11 +14065,12 @@  fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
   *slot = expr;
   code = TREE_CODE (expr);
   if (TREE_CODE_CLASS (code) == tcc_declaration
-      && DECL_ASSEMBLER_NAME_SET_P (expr))
+      && HAS_DECL_ASSEMBLER_NAME_P (expr))
     {
-      /* Allow DECL_ASSEMBLER_NAME to be modified.  */
+      /* Allow DECL_ASSEMBLER_NAME and symtab_node to be modified.  */
       memcpy ((char *) &buf, expr, tree_size (expr));
       SET_DECL_ASSEMBLER_NAME ((tree)&buf, NULL);
+      buf.decl_with_vis.symtab_node = NULL;
       expr = (tree) &buf;
     }
   else if (TREE_CODE_CLASS (code) == tcc_type