Commit ce5e43d0 by Jakub Jelinek

re PR c/6358 (GCC 3.1 ICE on statement expressions)

	PR c/6358
	* function.c: Reapply patch for c/6358.
	(expand_function_end): Copy decl_rtl's mode, not
	current_function_return_rtx mode.

From-SVN: r52538
parent 9eb83f6c
2002-04-19 Joel Sherrill <joel@OARcorp.com> 2002-04-19 Jakub Jelinek <jakub@redhat.com>
PR c/6358
* function.c: Reapply patch for c/6358.
(expand_function_end): Copy decl_rtl's mode, not
current_function_return_rtx mode.
2002-04-19 Joel Sherrill <joel@OARcorp.com>
* config/rtems.h (STARTFILE_SPEC, ENDFILE_SPEC): Fix for non-ELF * config/rtems.h (STARTFILE_SPEC, ENDFILE_SPEC): Fix for non-ELF
targets. targets.
......
...@@ -5145,6 +5145,35 @@ assign_parms (fndecl) ...@@ -5145,6 +5145,35 @@ assign_parms (fndecl)
current_function_return_rtx current_function_return_rtx
= (DECL_RTL_SET_P (DECL_RESULT (fndecl)) = (DECL_RTL_SET_P (DECL_RESULT (fndecl))
? DECL_RTL (DECL_RESULT (fndecl)) : NULL_RTX); ? DECL_RTL (DECL_RESULT (fndecl)) : NULL_RTX);
/* If scalar return value was computed in a pseudo-reg, or was a named
return value that got dumped to the stack, copy that to the hard
return register. */
if (DECL_RTL_SET_P (DECL_RESULT (fndecl)))
{
tree decl_result = DECL_RESULT (fndecl);
rtx decl_rtl = DECL_RTL (decl_result);
if (REG_P (decl_rtl)
? REGNO (decl_rtl) >= FIRST_PSEUDO_REGISTER
: DECL_REGISTER (decl_result))
{
rtx real_decl_rtl;
#ifdef FUNCTION_OUTGOING_VALUE
real_decl_rtl = FUNCTION_OUTGOING_VALUE (TREE_TYPE (decl_result),
fndecl);
#else
real_decl_rtl = FUNCTION_VALUE (TREE_TYPE (decl_result),
fndecl);
#endif
REG_FUNCTION_VALUE_P (real_decl_rtl) = 1;
/* The delay slot scheduler assumes that current_function_return_rtx
holds the hard register containing the return value, not a
temporary pseudo. */
current_function_return_rtx = real_decl_rtl;
}
}
} }
/* Indicate whether REGNO is an incoming argument to the current function /* Indicate whether REGNO is an incoming argument to the current function
...@@ -6958,23 +6987,18 @@ expand_function_end (filename, line, end_bindings) ...@@ -6958,23 +6987,18 @@ expand_function_end (filename, line, end_bindings)
? REGNO (decl_rtl) >= FIRST_PSEUDO_REGISTER ? REGNO (decl_rtl) >= FIRST_PSEUDO_REGISTER
: DECL_REGISTER (decl_result)) : DECL_REGISTER (decl_result))
{ {
rtx real_decl_rtl; rtx real_decl_rtl = current_function_return_rtx;
#ifdef FUNCTION_OUTGOING_VALUE /* This should be set in assign_parms. */
real_decl_rtl = FUNCTION_OUTGOING_VALUE (TREE_TYPE (decl_result), if (! REG_FUNCTION_VALUE_P (real_decl_rtl))
current_function_decl); abort ();
#else
real_decl_rtl = FUNCTION_VALUE (TREE_TYPE (decl_result),
current_function_decl);
#endif
REG_FUNCTION_VALUE_P (real_decl_rtl) = 1;
/* If this is a BLKmode structure being returned in registers, /* If this is a BLKmode structure being returned in registers,
then use the mode computed in expand_return. Note that if then use the mode computed in expand_return. Note that if
decl_rtl is memory, then its mode may have been changed, decl_rtl is memory, then its mode may have been changed,
but that current_function_return_rtx has not. */ but that current_function_return_rtx has not. */
if (GET_MODE (real_decl_rtl) == BLKmode) if (GET_MODE (real_decl_rtl) == BLKmode)
PUT_MODE (real_decl_rtl, GET_MODE (current_function_return_rtx)); PUT_MODE (real_decl_rtl, GET_MODE (decl_rtl));
/* If a named return value dumped decl_return to memory, then /* If a named return value dumped decl_return to memory, then
we may need to re-do the PROMOTE_MODE signed/unsigned we may need to re-do the PROMOTE_MODE signed/unsigned
...@@ -6995,11 +7019,6 @@ expand_function_end (filename, line, end_bindings) ...@@ -6995,11 +7019,6 @@ expand_function_end (filename, line, end_bindings)
int_size_in_bytes (TREE_TYPE (decl_result))); int_size_in_bytes (TREE_TYPE (decl_result)));
else else
emit_move_insn (real_decl_rtl, decl_rtl); emit_move_insn (real_decl_rtl, decl_rtl);
/* The delay slot scheduler assumes that current_function_return_rtx
holds the hard register containing the return value, not a
temporary pseudo. */
current_function_return_rtx = real_decl_rtl;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment