summaryrefslogtreecommitdiffstats
path: root/gcc/calls.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1993-03-29 01:26:03 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1993-03-29 01:26:03 +0000
commit199bbafef296e0995c8fd8ab4e731bd10df72d89 (patch)
tree174a88c648e61dae77756af0d9a7d1273aab3da2 /gcc/calls.c
parentd9321971a7f43c7bc20410f165f13ee3d86cfa12 (diff)
downloadppe42-gcc-199bbafef296e0995c8fd8ab4e731bd10df72d89.tar.gz
ppe42-gcc-199bbafef296e0995c8fd8ab4e731bd10df72d89.zip
(expand_call): Always allocate TARGET in mode of result expression;
VALREG might have been promoted. Ensure TARGET is a REG when checking for promotion and verify that we get back the mode we expect. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@3907 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/calls.c')
-rw-r--r--gcc/calls.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/calls.c b/gcc/calls.c
index 1d6837eb7af..14b2000161b 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -1834,10 +1834,12 @@ expand_call (exp, target, ignore)
target = copy_to_reg (valreg);
#ifdef PROMOTE_FUNCTION_RETURN
- /* If we promoted this return value, make the proper SUBREG. */
- if (GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
+ /* If we promoted this return value, make the proper SUBREG. TARGET
+ might be const0_rtx here, so be careful. */
+ if (GET_CODE (target) == REG
+ && GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
{
- enum machine_mode mode = GET_MODE (target);
+ enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));
int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
if (TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE
@@ -1851,6 +1853,10 @@ expand_call (exp, target, ignore)
PROMOTE_MODE (mode, unsignedp, TREE_TYPE (exp));
}
+ /* If we didn't promote as expected, something is wrong. */
+ if (mode != GET_MODE (target))
+ abort ();
+
target = gen_rtx (SUBREG, TYPE_MODE (TREE_TYPE (exp)), target, 0);
SUBREG_PROMOTED_VAR_P (target) = 1;
SUBREG_PROMOTED_UNSIGNED_P (target) = unsignedp;
OpenPOWER on IntegriCloud