re PR sanitizer/78651 (Incorrect exception handling when catch clause uses local...
authorJakub Jelinek <jakub@redhat.com>
Mon, 19 Mar 2018 20:48:39 +0000 (21:48 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 19 Mar 2018 20:48:39 +0000 (21:48 +0100)
PR sanitizer/78651
* dwarf2asm.c: Include fold-const.c.
(dw2_output_indirect_constant_1): Set DECL_INITIAL (decl) to ADDR_EXPR
of decl rather than decl itself.

From-SVN: r258664

gcc/ChangeLog
gcc/dwarf2asm.c

index 624bf15d94a8b58f9fb58cda7cbd028d97891043..9df89dcbca37647d0f6268d5fcffaeb15b821374 100644 (file)
@@ -1,5 +1,10 @@
 2018-03-19  Jakub Jelinek  <jakub@redhat.com>
 
+       PR sanitizer/78651
+       * dwarf2asm.c: Include fold-const.c.
+       (dw2_output_indirect_constant_1): Set DECL_INITIAL (decl) to ADDR_EXPR
+       of decl rather than decl itself.
+
        PR rtl-optimization/84643
        * memmodel.h (enum memmodel): Add MEMMODEL_MAX enumerator.
 
index 2e108acc0d78ef4a6b33d1ead837f4ccd48671dc..cdb629f21d348cac58c826a9e3bb50f5e822122c 100644 (file)
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "dwarf2.h"
 #include "function.h"
 #include "emit-rtl.h"
+#include "fold-const.h"
 
 #ifndef XCOFF_DEBUGGING_INFO
 #define XCOFF_DEBUGGING_INFO 0
@@ -954,7 +955,7 @@ dw2_output_indirect_constant_1 (const char *sym, tree id)
   SET_DECL_ASSEMBLER_NAME (decl, id);
   DECL_ARTIFICIAL (decl) = 1;
   DECL_IGNORED_P (decl) = 1;
-  DECL_INITIAL (decl) = decl;
+  DECL_INITIAL (decl) = build_fold_addr_expr (decl);
   TREE_READONLY (decl) = 1;
   TREE_STATIC (decl) = 1;