PATCH: PR rtl-optimization/39241: [4.4 Regression] ICE in subreg_get_info, at rtlanal.c:3104

H.J. Lu hjl.tools@gmail.com
Fri Feb 20 05:32:00 GMT 2009


On Wed, Aug 6, 2008 at 7:12 AM, Ian Lance Taylor <iant@google.com> wrote:
> "Joseph S. Myers" <joseph@codesourcery.com> writes:
>
>> 2008-08-02  Joseph Myers  <joseph@codesourcery.com>
>>
>>       * jump.c (rtx_renumbered_equal_p): Do not call subreg_regno_offset
>>       for unrepresentable subregs or treat them as equal to other regs
>>       or subregs with the same register number.
>
> This is OK.
>
> Thanks.
>

This patch may call subreg_offset_representable_p on pseudo registers,
which causes ICE, as shown in

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39241

OK for trunk if no regressions on Linux/ia32, Linux/ia64 and Linux/x86-64?

Thanks.


-- 
H.J.
---
gcc/

2008-02-19  H.J. Lu  <hongjiu.lu@intel.com>

	PR rtl-optimization/39241
	* jump.c (rtx_renumbered_equal_p): Call subreg_offset_representable_p
	only for hard registers.


gcc/testsuite/

2008-02-19  H.J. Lu  <hongjiu.lu@intel.com>

	PR rtl-optimization/39241
	* gcc.dg/torture/pr39241.c: New.
-------------- next part --------------
gcc/

2008-02-19  H.J. Lu  <hongjiu.lu@intel.com>

	PR rtl-optimization/39241
	* jump.c (rtx_renumbered_equal_p): Call subreg_offset_representable_p
	only for hard registers.


gcc/testsuite/

2008-02-19  H.J. Lu  <hongjiu.lu@intel.com>

	PR rtl-optimization/39241
	* gcc.dg/torture/pr39241.c: New.

--- gcc/jump.c.pr39241	2008-09-02 17:10:50.000000000 -0700
+++ gcc/jump.c	2009-02-19 17:10:14.000000000 -0800
@@ -1563,10 +1563,11 @@ rtx_renumbered_equal_p (const_rtx x, con
 					   GET_MODE (x));
 	      byte_x = 0;
 	    }
-	  else if (!subreg_offset_representable_p (reg_x,
-						   GET_MODE (SUBREG_REG (x)),
-						   byte_x,
-						   GET_MODE (x)))
+	  else if (reg_x < FIRST_PSEUDO_REGISTER
+		   && !subreg_offset_representable_p (reg_x,
+						      GET_MODE (SUBREG_REG (x)),
+						      byte_x,
+						      GET_MODE (x)))
 	    return 0;
 	}
       else
@@ -1594,10 +1595,11 @@ rtx_renumbered_equal_p (const_rtx x, con
 					   GET_MODE (y));
 	      byte_y = 0;
 	    }
-	  else if (!subreg_offset_representable_p (reg_y,
-						   GET_MODE (SUBREG_REG (y)),
-						   byte_y,
-						   GET_MODE (y)))
+	  else if (reg_y < FIRST_PSEUDO_REGISTER
+		   && !subreg_offset_representable_p (reg_y,
+						      GET_MODE (SUBREG_REG (y)),
+						      byte_y,
+						      GET_MODE (y)))
 	    return 0;
 	}
       else
--- gcc/testsuite/gcc.dg/torture/pr39241.c.pr39241	2009-02-19 17:12:16.000000000 -0800
+++ gcc/testsuite/gcc.dg/torture/pr39241.c	2009-02-19 17:11:39.000000000 -0800
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+
+static inline int
+foo (float f)
+{
+  return *((int *) &f) - 1;
+}
+
+float
+bar (float x, float y, float *z)
+{
+  float c = y < 0.002f ? 0.002f : y;
+  float d = x < c ? c : x;
+  return z[foo (c)] + z[foo (d * 255.0f)];
+}


More information about the Gcc-patches mailing list