]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/89503 (Checking ICE in 'gcc.dg/warn-strlen-no-nul.c')
authorJakub Jelinek <jakub@redhat.com>
Fri, 1 Mar 2019 09:26:40 +0000 (10:26 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 1 Mar 2019 09:26:40 +0000 (10:26 +0100)
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
gcc/fold-const.c

index bce3f74b5f3925f34f61771bac0f11b29c38e259..ef18defe74844456bc529e24323b44d2c12a01a9 100644 (file)
@@ -1,3 +1,9 @@
+2019-03-01  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <rguenther@suse.de>
 
        PR middle-end/89497
index b019a910839c68457436ff051fdf5e4335108796..8989fc7827e7108b704e1749fc2736d6b0baa091 100644 (file)
@@ -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);