(make_extraction): Don't make an extraction that has the potential of
authorRichard Kenner <kenner@gcc.gnu.org>
Tue, 1 Feb 1994 23:27:04 +0000 (18:27 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Tue, 1 Feb 1994 23:27:04 +0000 (18:27 -0500)
crossing a boundary.

From-SVN: r6462

gcc/combine.c

index d682939eb28a2f4c6776c4b992cf8903918a9bca..25f029702380f324e49bd17dcc66f07654ac0c33 100644 (file)
@@ -5120,6 +5120,16 @@ make_extraction (mode, inner, pos, pos_rtx, len,
       && ! in_compare && ! spans_byte && unsignedp)
     return 0;
 
+  /* Unless we are allowed to span bytes, reject this if we would be
+     spanning bytes or if the position is not a constant and the length
+     is not 1.  In all other cases, we would only be going outside
+     out object in cases when an original shift would have been
+     undefined.  */
+  if (! spans_byte
+      && ((pos_rtx == 0 && pos + len > GET_MODE_BITSIZE (is_mode))
+         || (pos_rtx != 0 && len != 1)))
+    return 0;
+
   /* Get the mode to use should INNER be a MEM, the mode for the position,
      and the mode for the result.  */
 #ifdef HAVE_insv