OSDN Git Service

* tree.h: Declare make_decl_rtl_for_debug.
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 18 Mar 2010 20:41:40 +0000 (20:41 +0000)
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 18 Mar 2010 20:41:40 +0000 (20:41 +0000)
* varasm.c (make_decl_rtl_for_debug): New.
* dwarf2out.c (rtl_for_decl_location): Call it.
* cfgexpand.c (expand_debug_expr): Call it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157551 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cfgexpand.c
gcc/dwarf2out.c
gcc/testsuite/gfortran.dg/assign-debug.f90 [new file with mode: 0644]
gcc/tree.h
gcc/varasm.c

index 527a9c3..018d94c 100644 (file)
@@ -1,3 +1,10 @@
+2010-03-18  Aldy Hernandez  <aldyh@redhat.com>
+
+       * tree.h: Declare make_decl_rtl_for_debug.
+       * varasm.c (make_decl_rtl_for_debug): New.
+       * dwarf2out.c (rtl_for_decl_location): Call it.
+       * cfgexpand.c (expand_debug_expr): Call it.
+
 2010-03-18  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/43399
index ee14599..fcae897 100644 (file)
@@ -2339,8 +2339,7 @@ expand_debug_expr (tree exp)
              || mode == VOIDmode)
            return NULL;
 
-         op0 = DECL_RTL (exp);
-         SET_DECL_RTL (exp, NULL);
+         op0 = make_decl_rtl_for_debug (exp);
          if (!MEM_P (op0)
              || GET_CODE (XEXP (op0, 0)) != SYMBOL_REF
              || SYMBOL_REF_DECL (XEXP (op0, 0)) != exp)
index 8dfe65d..540d75f 100644 (file)
@@ -15770,10 +15770,7 @@ rtl_for_decl_location (tree decl)
       && !DECL_HARD_REGISTER (decl)
       && DECL_MODE (decl) != VOIDmode)
     {
-      rtl = DECL_RTL (decl);
-      /* Reset DECL_RTL back, as various parts of the compiler expects
-        DECL_RTL set meaning it is actually going to be output.  */
-      SET_DECL_RTL (decl, NULL);
+      rtl = make_decl_rtl_for_debug (decl);
       if (!MEM_P (rtl)
          || GET_CODE (XEXP (rtl, 0)) != SYMBOL_REF
          || SYMBOL_REF_DECL (XEXP (rtl, 0)) != decl)
diff --git a/gcc/testsuite/gfortran.dg/assign-debug.f90 b/gcc/testsuite/gfortran.dg/assign-debug.f90
new file mode 100644 (file)
index 0000000..bd44121
--- /dev/null
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! { dg-options "-fcompare-debug -O2" }
+      program test
+      integer i
+      common i
+      assign 2000 to i  ! { dg-warning "Deleted feature: ASSIGN statement" }
+2000  continue
+      end
index 7e51ea6..bc3cd29 100644 (file)
@@ -5131,6 +5131,7 @@ extern unsigned int update_alignment_for_field (record_layout_info, tree,
                                                 unsigned int);
 /* varasm.c */
 extern void make_decl_rtl (tree);
+extern rtx make_decl_rtl_for_debug (tree);
 extern void make_decl_one_only (tree, tree);
 extern int supports_one_only (void);
 extern void resolve_unique_section (tree, int, int);
index 6b8222f..31007b8 100644 (file)
@@ -1476,6 +1476,38 @@ make_decl_rtl (tree decl)
   if (flag_mudflap && TREE_CODE (decl) == VAR_DECL)
     mudflap_enqueue_decl (decl);
 }
+
+/* Like make_decl_rtl, but inhibit creation of new alias sets when
+   calling make_decl_rtl.  Also, reset DECL_RTL before returning the
+   rtl.  */
+
+rtx
+make_decl_rtl_for_debug (tree decl)
+{
+  unsigned int save_aliasing_flag;
+  rtx rtl;
+
+  if (DECL_RTL_SET_P (decl))
+    return DECL_RTL (decl);
+
+  /* Kludge alert!  Somewhere down the call chain, make_decl_rtl will
+     call new_alias_set.  If running with -fcompare-debug, sometimes
+     we do not want to create alias sets that will throw the alias
+     numbers off in the comparison dumps.  So... clearing
+     flag_strict_aliasing will keep new_alias_set() from creating a
+     new set.  */
+  save_aliasing_flag = flag_strict_aliasing;
+  flag_strict_aliasing = 0;
+
+  rtl = DECL_RTL (decl);
+  /* Reset DECL_RTL back, as various parts of the compiler expects
+     DECL_RTL set meaning it is actually going to be output.  */
+  SET_DECL_RTL (decl, NULL);
+
+  flag_strict_aliasing = save_aliasing_flag;
+
+  return rtl;
+}
 \f
 /* Output a string of literal assembler code
    for an `asm' keyword used between functions.  */