diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a467635fd04..8e2f3c1c683 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-02-02 Richard Henderson + + PR target/13789 + * expr.c (store_expr): Use force_operand before emit_move_insn. + 2004-02-02 Jeff Law Roger Sayle diff --git a/gcc/expr.c b/gcc/expr.c index 8bf073252e2..ba27b04d115 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -4334,7 +4334,11 @@ store_expr (tree exp, rtx target, int want_value) (want_value & 2 ? BLOCK_OP_CALL_PARM : BLOCK_OP_NORMAL)); else - emit_move_insn (target, temp); + { + temp = force_operand (temp, target); + if (temp != target) + emit_move_insn (target, temp); + } } /* If we don't want a value, return NULL_RTX. */ diff --git a/gcc/testsuite/gcc.c-torture/compile/20040202-1.c b/gcc/testsuite/gcc.c-torture/compile/20040202-1.c new file mode 100644 index 00000000000..ba32c804905 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040202-1.c @@ -0,0 +1,8 @@ +/* PR target/13789 */ +/* Failed on SPARC due to a bug in store_expr. */ + +void *foo (void *c) +{ + void *a = __builtin_extract_return_addr (c); + return a; +}