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]

[PATCH] Handle MEM_REF with non-zero offset in expand_debug_expr


Hi!

Each of x86_64-linux and i686-linux bootstrap/regtests triggers
MEM_REF with non-zero offset more than 68000 times, so IMNSHO it
is worth to handle it.

Fixed thusly, bootstrapped/regtested it on x86_64-linux and i686-linux, ok
for trunk?

2010-11-04  Jakub Jelinek  <jakub@redhat.com>

	* cfgexpand.c (expand_debug_expr): Handle MEM_REF
	with non-zero offset.

--- gcc/cfgexpand.c.jj	2010-11-04 20:12:19.000000000 +0100
+++ gcc/cfgexpand.c	2010-11-04 20:46:12.160386088 +0100
@@ -2552,15 +2552,20 @@ expand_debug_expr (tree exp)
       }
 
     case MEM_REF:
-      /* ??? FIXME.  */
-      if (!integer_zerop (TREE_OPERAND (exp, 1)))
-	return NULL;
-      /* Fallthru.  */
     case INDIRECT_REF:
       op0 = expand_debug_expr (TREE_OPERAND (exp, 0));
       if (!op0)
 	return NULL;
 
+      if (TREE_CODE (exp) == MEM_REF)
+	{
+	  op1 = expand_debug_expr (TREE_OPERAND (exp, 1));
+	  if (!op1 || !CONST_INT_P (op1))
+	    return NULL;
+
+	  op0 = plus_constant (op0, INTVAL (op1));
+	}
+
       if (POINTER_TYPE_P (TREE_TYPE (exp)))
 	as = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (exp)));
       else

	Jakub


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