(expand_increment): Handle both BAD_SUBREG and POST.
authorRichard Kenner <kenner@gcc.gnu.org>
Wed, 16 Feb 1994 00:30:29 +0000 (19:30 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Wed, 16 Feb 1994 00:30:29 +0000 (19:30 -0500)
From-SVN: r6567

gcc/expr.c

index c4356ae17f9f147a927336cd4f7e1715a98bf643..ae1e5a46569498816a8bcca64112ff891044b91a 100644 (file)
@@ -7951,7 +7951,15 @@ expand_increment (exp, post)
     SUBREG_REG (op0) = copy_to_reg (SUBREG_REG (op0));
   else if (GET_CODE (op0) == SUBREG
           && GET_MODE_BITSIZE (GET_MODE (op0)) < BITS_PER_WORD)
-    bad_subreg = 1;
+    {
+      /* We cannot increment this SUBREG in place.  If we are
+        post-incrementing, get a copy of the old value.  Otherwise,
+        just mark that we cannot increment in place.  */
+      if (post)
+       op0 = copy_to_reg (op0);
+      else
+       bad_subreg = 1;
+    }
 
   op0_is_copy = ((GET_CODE (op0) == SUBREG || GET_CODE (op0) == REG)
                 && temp != get_last_insn ());