aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@redhat.co.uk>2000-09-15 15:35:03 +0000
committerBernd Schmidt <crux@gcc.gnu.org>2000-09-15 15:35:03 +0000
commitaff2c2d3af3233dfb2d237341f2fd8612dc61391 (patch)
treec85b3d299188bdcde03c7dc4b888789f679aa2e9 /gcc
parent4eaa189a5cfd20ca0f5271b4ca0240673ec61f44 (diff)
downloadgcc-aff2c2d3af3233dfb2d237341f2fd8612dc61391.zip
gcc-aff2c2d3af3233dfb2d237341f2fd8612dc61391.tar.gz
gcc-aff2c2d3af3233dfb2d237341f2fd8612dc61391.tar.bz2
Avoid copying libcall results directly to user variables.
From-SVN: r36433
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/optabs.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c80ffa8..6c1152a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2000-09-15 Bernd Schmidt <bernds@redhat.co.uk>
+
+ * optabs.c (emit_libcall_block): If target is a user variable,
+ copy to a temporary first.
+
2000-09-15 Richard Henderson <rth@cygnus.com>
* expmed.c (store_bit_field): Consider naturally aligned
diff --git a/gcc/optabs.c b/gcc/optabs.c
index f35300b..136f178 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -2756,8 +2756,14 @@ emit_libcall_block (insns, target, result, equiv)
rtx result;
rtx equiv;
{
+ rtx final_dest = target;
rtx prev, next, first, last, insn;
+ /* If this is a reg with REG_USERVAR_P set, then it could possibly turn
+ into a MEM later. Protect the libcall block from this change. */
+ if (! REG_P (target) || REG_USERVAR_P (target))
+ target = gen_reg_rtx (GET_MODE (target));
+
/* look for any CALL_INSNs in this sequence, and attach a REG_EH_REGION
reg note to indicate that this call cannot throw or execute a nonlocal
goto. (Unless there is already a REG_EH_REGION note, in which case
@@ -2833,6 +2839,8 @@ emit_libcall_block (insns, target, result, equiv)
remove_note (last, find_reg_note (last, REG_EQUAL, NULL_RTX));
}
+ emit_move_insn (final_dest, target);
+
if (prev == 0)
first = get_insns ();
else