This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: VTA alias set discrepancy


Moving thread to gcc-patches.

This is what I'm testing, and had it not been for a power failure I
would've had tests results.

OK pending tests?

	* dwarf2out.c (make_decl_rtl_for_debug): New.
	(rtl_for_decl_location): Call it.

Index: testsuite/gfortran.dg/assign-debug.f90
===================================================================
--- testsuite/gfortran.dg/assign-debug.f90	(revision 0)
+++ testsuite/gfortran.dg/assign-debug.f90	(revision 0)
@@ -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: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 157481)
+++ dwarf2out.c	(working copy)
@@ -15560,6 +15560,38 @@ rtl_for_decl_init (tree init, tree type)
   return rtl;
 }
 
+/* Like make_decl_rtl, but inhibit creation of new alias sets when
+   calling make_decl_rtl.  Also, reset DECL_RTL before returning the
+   rtl.  */
+
+static rtx
+make_decl_rtl_for_debug (tree decl)
+{
+  unsigned int save_aliasing_flag;
+  rtx rtl;
+
+  /* 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.  */
+  if (flag_compare_debug)
+    {
+      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);
+
+  if (flag_compare_debug)
+    flag_strict_aliasing = save_aliasing_flag;
+  return rtl;
+}
+
 /* Generate RTL for the variable DECL to represent its location.  */
 
 static rtx
@@ -15770,10 +15802,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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]