re PR target/43636 (ICE in extract_insn, at recog.c:2103)
authorJakub Jelinek <jakub@gcc.gnu.org>
Fri, 28 May 2010 13:35:56 +0000 (15:35 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 28 May 2010 13:35:56 +0000 (15:35 +0200)
PR target/43636
* builtins.c (expand_movstr): Use a temporary pseudo instead
of target even when target is not NULL and not const0_rtx, but
fails movstr predicate.
* config/m32c/blkmov.md (movstr): Add predicate to first operand.

* gcc.c-torture/compile/pr43636.c: New test.

From-SVN: r159972

gcc/ChangeLog
gcc/builtins.c
gcc/config/m32c/blkmov.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr43636.c [new file with mode: 0644]

index 9afbc7e09a8ab07f3671e9cd98cc980f3e803ce2..f347f7aaeab88e82068e108f81d5287229cfe30a 100644 (file)
@@ -1,3 +1,11 @@
+2010-05-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/43636
+       * builtins.c (expand_movstr): Use a temporary pseudo instead
+       of target even when target is not NULL and not const0_rtx, but
+       fails movstr predicate.
+       * config/m32c/blkmov.md (movstr): Add predicate to first operand.
+
 2010-05-28  Joseph Myers  <joseph@codesourcery.com>
 
        * final.c (rest_of_clean_state): Use %m in errors instead of
index e16240b579a96743c6bee6ed3984ac7c616a6c8f..e57449ddcaecf139b4c3491a913159854409ee9e 100644 (file)
@@ -3560,6 +3560,7 @@ expand_movstr (tree dest, tree src, rtx target, int endp)
 
   dest_mem = get_memory_rtx (dest, NULL);
   src_mem = get_memory_rtx (src, NULL);
+  data = insn_data + CODE_FOR_movstr;
   if (!endp)
     {
       target = force_reg (Pmode, XEXP (dest_mem, 0));
@@ -3568,18 +3569,18 @@ expand_movstr (tree dest, tree src, rtx target, int endp)
     }
   else
     {
-      if (target == 0 || target == const0_rtx)
+      if (target == 0
+         || target == const0_rtx
+         || ! (*data->operand[0].predicate) (target, Pmode))
        {
          end = gen_reg_rtx (Pmode);
-         if (target == 0)
+         if (target != const0_rtx)
            target = end;
        }
       else
        end = target;
     }
 
-  data = insn_data + CODE_FOR_movstr;
-
   if (data->operand[0].mode != VOIDmode)
     end = gen_lowpart (data->operand[0].mode, end);
 
index a734f71789b306fab09227ea0a1604a73447499c..e384d3c52b5fef069899120485294d6ae8d05ae7 100644 (file)
@@ -1,5 +1,5 @@
 ;; Machine Descriptions for R8C/M16C/M32C
-;; Copyright (C) 2006, 2007
+;; Copyright (C) 2006, 2007, 2010
 ;; Free Software Foundation, Inc.
 ;; Contributed by Red Hat.
 ;;
 ;; 2 = source (mem:BLK ...)
 
 (define_expand "movstr"
-  [(match_operand 0 "" "")
+  [(match_operand 0 "m32c_nonimmediate_operand" "")
    (match_operand 1 "ap_operand" "")
    (match_operand 2 "ap_operand" "")
    ]
index 38c44a38b4e5e6b619b7e9d57298f764467a4c20..ae8d2c001a489495c38b062e235883f938d8a445 100644 (file)
@@ -1,6 +1,11 @@
+2010-05-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/43636
+       * gcc.c-torture/compile/pr43636.c: New test.
+
 2010-05-28  Iain Sandoe  <iains@gcc.gnu.org>
 
-       PR ObjC++/23616
+       PR objc++/23616
        * obj-c++.dg/try-catch-2.mm: Adjust xfail.
        * obj-c++.dg/try-catch-9.mm: Ditto.
 
@@ -21,7 +26,7 @@
 
 2010-05-27  Iain Sandoe  <iains@gcc.gnu.org>
 
-       PR ObjC/44140
+       PR objc/44140
        * objc.dg/torture/tls/thr-init-2.m: Skip for -flto, -fwhopr.
        * objc.dg/torture/tls/thr-init-3.m: Ditto.
        * objc.dg/torture/tls/thr-init.m: Ditto.
 
 2010-05-25  Iain Sandoe  <iains@gcc.gnu.org>
 
-       PR ObjC/44140
+       PR objc/44140
        * objc.dg/torture/tls/thr-init-3.m: XFAIL lto/whopr for all.
 
 2010-05-25  Iain Sandoe  <iains@gcc.gnu.org>
 
 2010-05-24  Iain Sandoe  <iains@gcc.gnu.org>
 
-       PR ObjC++/43689
+       PR objc++/43689
        * obj-c++.dg/const-str-5.mm: Name pointer equivalence union.
        * obj-c++.dg/const-str-6.mm: Ditto.
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43636.c b/gcc/testsuite/gcc.c-torture/compile/pr43636.c
new file mode 100644 (file)
index 0000000..ebf50ed
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR target/43636 */
+
+extern char a[], *b[];
+
+char *
+foo (char *x, int y)
+{
+  x = __builtin_stpcpy (x, b[a[y]]);
+  return x;
+}