diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9afbc7e09a8..f347f7aaeab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2010-05-28 Jakub Jelinek + + 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 * final.c (rest_of_clean_state): Use %m in errors instead of diff --git a/gcc/builtins.c b/gcc/builtins.c index e16240b579a..e57449ddcae 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -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); diff --git a/gcc/config/m32c/blkmov.md b/gcc/config/m32c/blkmov.md index a734f71789b..e384d3c52b5 100644 --- a/gcc/config/m32c/blkmov.md +++ b/gcc/config/m32c/blkmov.md @@ -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. ;; @@ -214,7 +214,7 @@ ;; 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" "") ] diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 38c44a38b4e..ae8d2c001a4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ +2010-05-28 Jakub Jelinek + + PR target/43636 + * gcc.c-torture/compile/pr43636.c: New test. + 2010-05-28 Iain Sandoe - 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 - 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. @@ -152,7 +157,7 @@ 2010-05-25 Iain Sandoe - PR ObjC/44140 + PR objc/44140 * objc.dg/torture/tls/thr-init-3.m: XFAIL lto/whopr for all. 2010-05-25 Iain Sandoe @@ -182,7 +187,7 @@ 2010-05-24 Iain Sandoe - 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 index 00000000000..ebf50edf312 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43636.c @@ -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; +}