On Fri, 1 Mar 2019, Jakub Jelinek wrote:

> Hi!
> 
> Some of the builtin folding sets TREE_NO_WARNING flags, which triggers as
> --enable-checking=fold errors.  I think we should allow setting of
> TREE_NO_WARNING flag when folding, so this patch arranges that.
> 
> Tested on:
> ../configure --enable-languages=c,c++,fortran --enable-checking=fold 
> --disable-bootstrap
> make -jN && make -jN -k check
> No extra FAILs compared to normal regtest.  Ok for trunk?

Hmm, I guess it's OK though for EXPR_P I think we may want the
TREE_NO_WARNING setter to unshare the tree?  Because IIRC it is
exactly because of tree sharing that we do this kind of checking?

Richard.

> 2019-03-01  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR middle-end/89503
>       * fold-const.c (fold_checksum_tree): Ignore TREE_NO_WARNING bit
>       on DECL_P and EXPR_P.
> 
> --- gcc/fold-const.c.jj       2019-02-21 00:01:05.714931643 +0100
> +++ gcc/fold-const.c  2019-02-27 12:27:38.749353680 +0100
> @@ -12130,6 +12130,7 @@ fold_checksum_tree (const_tree expr, str
>        memcpy ((char *) &buf, expr, tree_size (expr));
>        SET_DECL_ASSEMBLER_NAME ((tree)&buf, NULL);
>        buf.decl_with_vis.symtab_node = NULL;
> +      buf.base.nowarning_flag = 0;
>        expr = (tree) &buf;
>      }
>    else if (TREE_CODE_CLASS (code) == tcc_type
> @@ -12155,6 +12156,13 @@ fold_checksum_tree (const_tree expr, str
>         TYPE_CACHED_VALUES (tmp) = NULL;
>       }
>      }
> +  else if (TREE_NO_WARNING (expr) && (DECL_P (expr) || EXPR_P (expr)))
> +    {
> +      /* Allow TREE_NO_WARNING to be set.  */
> +      memcpy ((char *) &buf, expr, tree_size (expr));
> +      buf.base.nowarning_flag = 0;
> +      expr = (tree) &buf;
> +    }
>    md5_process_bytes (expr, tree_size (expr), ctx);
>    if (CODE_CONTAINS_STRUCT (code, TS_TYPED))
>      fold_checksum_tree (TREE_TYPE (expr), ctx, ht);
> 
>       Jakub
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
21284 (AG Nuernberg)

Reply via email to