re PR rtl-optimization/25890 (testsuite failure: gcc.c-torture/compile/20051228-1.c)
authorPaolo Bonzini <bonzini@gnu.org>
Tue, 24 Jan 2006 14:29:25 +0000 (14:29 +0000)
committerPaolo Bonzini <bonzini@gcc.gnu.org>
Tue, 24 Jan 2006 14:29:25 +0000 (14:29 +0000)
2006-01-23  Paolo Bonzini  <bonzini@gnu.org>

        PR rtl-optimization/25890
        PR rtl-optimization/25905
        * combine.c (expand_compound_operation, expand_field_assignment):
        Fail if the bitfield's final position is out of bounds.

From-SVN: r110170

gcc/ChangeLog
gcc/combine.c

index 74eba52..d5046c4 100644 (file)
@@ -1,3 +1,10 @@
+2006-01-23  Paolo Bonzini  <bonzini@gnu.org>
+
+        PR rtl-optimization/25890
+        PR rtl-optimization/25905
+        * combine.c (expand_compound_operation, expand_field_assignment):
+        Fail if the bitfield's final position is out of bounds.
+
 2006-01-24  Ian Lance Taylor  <ian@airs.com>
 
        PR middle-end/25930
index 55f5723..0ec4580 100644 (file)
@@ -5640,8 +5640,9 @@ expand_compound_operation (rtx x)
       len = INTVAL (XEXP (x, 1));
       pos = INTVAL (XEXP (x, 2));
 
-      /* This should stay within the object being extracted, fail.  */
-      gcc_assert (len + pos <= GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))));
+      /* This should stay within the object being extracted, fail otherwise.  */
+      if (len + pos > GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))))
+       return x;
 
       if (BITS_BIG_ENDIAN)
        pos = GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - len - pos;
@@ -5800,9 +5801,9 @@ expand_field_assignment (rtx x)
          pos = XEXP (SET_DEST (x), 2);
 
          /* A constant position should stay within the width of INNER.  */
-         if (GET_CODE (pos) == CONST_INT)
-           gcc_assert (INTVAL (pos) + len
-                       <= GET_MODE_BITSIZE (GET_MODE (inner)));
+         if (GET_CODE (pos) == CONST_INT
+             && INTVAL (pos) + len > GET_MODE_BITSIZE (GET_MODE (inner)))
+           break;
 
          if (BITS_BIG_ENDIAN)
            {