summaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-02 02:31:22 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-02 02:31:22 +0000
commitc54c942211d704c2ab1a7ff01fa896051c83bf88 (patch)
treec7c92d96f32e636df33dde2f85860e4404e7cb89 /gcc/function.c
parent7e40817d161124b5d0573ace6518d806881efc72 (diff)
downloadgcc-c54c942211d704c2ab1a7ff01fa896051c83bf88.tar.gz
* function.c (expand_function_end): Properly handle DECL_RESULT
and copy when ptr_mode != Pmode. * expmed.c (make_tree): Convert X from Pmode to ptr_mode, if needed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38607 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 586ef7ea92e..bbd7ecc3e97 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1,6 +1,6 @@
/* Expands front end tree to back end RTL for GNU C-Compiler
Copyright (C) 1987, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000 Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -6825,8 +6825,8 @@ expand_function_end (filename, line, end_bindings)
if (current_function_returns_struct
|| current_function_returns_pcc_struct)
{
- rtx value_address =
- XEXP (DECL_RTL (DECL_RESULT (current_function_decl)), 0);
+ rtx value_address
+ = XEXP (DECL_RTL (DECL_RESULT (current_function_decl)), 0);
tree type = TREE_TYPE (DECL_RESULT (current_function_decl));
#ifdef FUNCTION_OUTGOING_VALUE
rtx outgoing
@@ -6834,15 +6834,25 @@ expand_function_end (filename, line, end_bindings)
current_function_decl);
#else
rtx outgoing
- = FUNCTION_VALUE (build_pointer_type (type),
- current_function_decl);
+ = FUNCTION_VALUE (build_pointer_type (type), current_function_decl);
#endif
/* Mark this as a function return value so integrate will delete the
assignment and USE below when inlining this function. */
REG_FUNCTION_VALUE_P (outgoing) = 1;
+#ifdef POINTERS_EXTEND_UNSIGNED
+ /* The address may be ptr_mode and OUTGOING may be Pmode. */
+ if (GET_MODE (outgoing) != GET_MODE (value_address))
+ value_address = convert_memory_address (GET_MODE (outgoing),
+ value_address);
+#endif
+
emit_move_insn (outgoing, value_address);
+
+ /* Show return register used to hold result (in this case the address
+ of the result. */
+ current_function_return_rtx = outgoing;
}
/* ??? This should no longer be necessary since stupid is no longer with