re PR sanitizer/85018 (Many sanitizer tests ICE since r258681)
authorJakub Jelinek <jakub@redhat.com>
Thu, 22 Mar 2018 08:32:12 +0000 (09:32 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 22 Mar 2018 08:32:12 +0000 (09:32 +0100)
PR sanitizer/85018
* dwarf2asm.c (dw2_output_indirect_constant_1): Set
DECL_INITIAL (decl) to decl at the end.
* varasm.c (use_blocks_for_decl_p): Revert the 2018-03-20 change,
adjust the comment.

From-SVN: r258757

gcc/ChangeLog
gcc/dwarf2asm.c
gcc/varasm.c

index 90c558c0638c0738e2b4eeca58f6792b422716af..869caa2fe6d5d5487f3c8262aaf01d5860997b2c 100644 (file)
@@ -1,3 +1,11 @@
+2018-03-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR sanitizer/85018
+       * dwarf2asm.c (dw2_output_indirect_constant_1): Set
+       DECL_INITIAL (decl) to decl at the end.
+       * varasm.c (use_blocks_for_decl_p): Revert the 2018-03-20 change,
+       adjust the comment.
+
 2018-03-21  Joseph Myers  <joseph@codesourcery.com>
 
        * doc/extend.texi (__builtin_tgmath): Document when complex
index 53fc0dab0b274cd97e2216cd5297e11eb9437357..93577d141abd1226b90b959ba72a78a70b82033e 100644 (file)
@@ -982,6 +982,9 @@ dw2_output_indirect_constant_1 (const char *sym, tree id)
   flag_section_anchors = save_flag_section_anchors;
   flag_sanitize = save_flag_sanitize;
   assemble_integer (sym_ref, POINTER_SIZE_UNITS, POINTER_SIZE, 1);
+  /* The following is a hack recognized by use_blocks_for_decl_p to disable
+     section anchor handling of the decl.  */
+  DECL_INITIAL (decl) = decl;
 
   return 0;
 }
index d7290ae534d061cb6a74dc30f924a6269cb6d9c6..d24bac4ad8fa9d41fcaa4cd6455c6c219796ce0d 100644 (file)
@@ -1253,6 +1253,12 @@ use_blocks_for_decl_p (tree decl)
   if (!VAR_P (decl) && TREE_CODE (decl) != CONST_DECL)
     return false;
 
+  /* DECL_INITIAL (decl) set to decl is a hack used for some decls that
+     are never used from code directly and we never want object block handling
+     for those.  */
+  if (DECL_INITIAL (decl) == decl)
+    return false;
+
   /* If this decl is an alias, then we don't want to emit a
      definition.  */
   if (VAR_P (decl)