[PATCH] Fix a thinko in vt_expand_loc_callback (PR debug/43304)

Jakub Jelinek jakub@redhat.com
Tue Mar 9 15:22:00 GMT 2010


Hi!

This patch fixes vmx/fft.c, vmx/7-01.c and vmx/7-01a.c tests
on powerpc - in the SUBREG case I've missed one case which needs to
call the dummy variant of the function when in dummy variant.  Otherwise
it allocates memory (wastes GC space) and, what's worse, it calls the
callback still in dummy mode so it returns pc_rtx on success instead of
some real expression, and simplification can then ICE when simplifying an
expression involving (pc) in places it doesn't expect.

Fixed thusly, bootstrap/regtest on x86_64-linux, i686-linux and
powerpc64-linux pending.  Ok for trunk?

2010-03-09  Jakub Jelinek  <jakub@redhat.com>

	PR debug/43304
	* var-tracking.c (vt_expand_loc_callback) <case SUBREG>: If dummy,
	call cselib_dummy_expand_value_rtx_cb instead of
	cselib_expand_value_rtx_cb.

--- gcc/var-tracking.c.jj	2010-03-09 12:25:04.000000000 +0100
+++ gcc/var-tracking.c	2010-03-09 13:15:36.000000000 +0100
@@ -6610,6 +6610,16 @@ vt_expand_loc_callback (rtx x, bitmap re
   switch (GET_CODE (x))
     {
     case SUBREG:
+      if (dummy)
+	{
+	  if (cselib_dummy_expand_value_rtx_cb (SUBREG_REG (x), regs,
+						max_depth - 1,
+						vt_expand_loc_callback, data))
+	    return pc_rtx;
+	  else
+	    return NULL;
+	}
+
       subreg = cselib_expand_value_rtx_cb (SUBREG_REG (x), regs,
 					   max_depth - 1,
 					   vt_expand_loc_callback, data);
@@ -6617,9 +6627,6 @@ vt_expand_loc_callback (rtx x, bitmap re
       if (!subreg)
 	return NULL;
 
-      if (dummy)
-	return pc_rtx;
-
       result = simplify_gen_subreg (GET_MODE (x), subreg,
 				    GET_MODE (SUBREG_REG (x)),
 				    SUBREG_BYTE (x));

	Jakub



More information about the Gcc-patches mailing list