From c6b363486fc0c421f09cbf7fbc9a7c8bd20ea4eb Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 1 Mar 2019 10:26:40 +0100 Subject: [PATCH] re PR middle-end/89503 (Checking ICE in 'gcc.dg/warn-strlen-no-nul.c') PR middle-end/89503 * fold-const.c (fold_checksum_tree): Ignore TREE_NO_WARNING bit on DECL_P and EXPR_P. From-SVN: r269303 --- gcc/ChangeLog | 6 ++++++ gcc/fold-const.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bce3f74b5f3..ef18defe748 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-01 Jakub Jelinek + + PR middle-end/89503 + * fold-const.c (fold_checksum_tree): Ignore TREE_NO_WARNING bit + on DECL_P and EXPR_P. + 2019-03-01 Richard Biener PR middle-end/89497 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index b019a910839..8989fc7827e 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -12130,6 +12130,7 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx, 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,14 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx, TYPE_CACHED_VALUES (tmp) = NULL; } } + else if (TREE_NO_WARNING (expr) && (DECL_P (expr) || EXPR_P (expr))) + { + /* Allow TREE_NO_WARNING to be set. Perhaps we shouldn't allow that + and change builtins.c etc. instead - see PR89543. */ + 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); -- 2.30.2