summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorkkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-11 02:12:42 +0000
committerkkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-11 02:12:42 +0000
commit360738f1a5bd169ed4049132a474a1adb716675d (patch)
tree0b563d56025cd02e2b9c54a6bde629270c77a6e2 /gcc
parent4eace1907a493f418d1a9123349380be5ff210a1 (diff)
downloadgcc-360738f1a5bd169ed4049132a474a1adb716675d.tar.gz
PR target/24445
* calls.c (expand_call): Copy a return value to a plain register if needed. * gcc.dg/pr24445.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106774 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/calls.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr24445.c9
4 files changed, 28 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c5f5bbae166..ec775d21c53 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2005-11-11 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ PR target/24445
+ * calls.c (expand_call): Copy a return value to a plain register
+ if needed.
+
2005-11-10 Alexandre Oliva <aoliva@redhat.com>
PR target/24778
diff --git a/gcc/calls.c b/gcc/calls.c
index 1a680ae5159..920c81575e0 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2857,6 +2857,14 @@ expand_call (tree exp, rtx target, int ignore)
&& GET_MODE (target) == TYPE_MODE (TREE_TYPE (exp))
&& GET_MODE (target) == GET_MODE (valreg))
{
+ /* We have to copy a return value in a CLASS_LIKELY_SPILLED hard
+ reg to a plain register. */
+ if (REG_P (valreg)
+ && HARD_REGISTER_P (valreg)
+ && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (REGNO (valreg)))
+ && !(REG_P (target) && !HARD_REGISTER_P (target)))
+ valreg = copy_to_reg (valreg);
+
/* TARGET and VALREG cannot be equal at this point because the
latter would not have REG_FUNCTION_VALUE_P true, while the
former would if it were referring to the same register.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ac89480809b..e2557a7991b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-11-11 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ PR target/24445
+ * gcc.dg/pr24445.c: New test.
+
2005-11-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/24655
diff --git a/gcc/testsuite/gcc.dg/pr24445.c b/gcc/testsuite/gcc.dg/pr24445.c
new file mode 100644
index 00000000000..e001be6b966
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr24445.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-O1 -fpic" } */
+extern int bar (void) __attribute__ ((__pure__));
+extern char *baz;
+void
+foo (void)
+{
+ baz = (char *) bar ();
+}