PATCH: Fix member.C on IRIX 6.5
Mark Mitchell
mark@codesourcery.com
Fri May 18 00:25:00 GMT 2001
IRIX 6.5 is now using SJLJ exceptions. (How sad.)
This revealed a latent bug in function.c. Here is what happenned:
- A C++ function wanted to return a pointer-to-member, which is
a 64-bit struct, with two 32-bit fields.
- Since it's a struct, it has BLKmode.
- The IRIX ABI says that such things should be returned in a
DImode register.
- We created a BLKmode register to hold the result.
- We called emit_move_insn to put something there.
- Boom.
Here's the fix, bootstrapped and tested on i686-pc-linux-gnu, and
mips-sgi-irix6.5. Installed on the mainline and on the branch.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2001-05-18 Mark Mitchell <mark@codesourcery.com>
* function.c (expand_function_start): Avoid creating BLKmode
pseudos.
Index: gcc/function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.250.2.9
diff -c -p -r1.250.2.9 function.c
*** function.c 2001/05/13 07:09:54 1.250.2.9
--- function.c 2001/05/18 06:26:34
*************** expand_function_start (subr, parms_have_
*** 6363,6383 ****
|| current_function_instrument_entry_exit
|| (flag_exceptions && USING_SJLJ_EXCEPTIONS))
{
! /* If function will end with cleanup code for parms,
! compute the return values into a pseudo reg,
! which we will copy into the true return register
! after the cleanups are done. */
! enum machine_mode mode = DECL_MODE (DECL_RESULT (subr));
! #ifdef PROMOTE_FUNCTION_RETURN
! tree type = TREE_TYPE (DECL_RESULT (subr));
! int unsignedp = TREE_UNSIGNED (type);
! mode = promote_mode (type, mode, &unsignedp, 1);
! #endif
!
! SET_DECL_RTL (DECL_RESULT (subr), gen_reg_rtx (mode));
/* Needed because we may need to move this to memory
in case it's a named return value whose address is taken. */
DECL_REGISTER (DECL_RESULT (subr)) = 1;
--- 6363,6387 ----
|| current_function_instrument_entry_exit
|| (flag_exceptions && USING_SJLJ_EXCEPTIONS))
{
! /* If function will end with cleanup code for parms, compute the
! return values into a pseudo reg, which we will copy into the
! true return register after the cleanups are done. */
! /* In order to figure out what mode to use for the pseudo, we
! figure out what the mode of the eventual return register will
! actually be, and use that. */
! rtx hard_reg
! = hard_function_value (TREE_TYPE (DECL_RESULT (subr)),
! subr, 1);
! /* Since we know the return value is not an aggregate, we should
! have a REG here. */
! if (!REG_P (hard_reg))
! abort ();
! /* Create the pseudo. */
! SET_DECL_RTL (DECL_RESULT (subr),
! gen_reg_rtx (GET_MODE (hard_reg)));
/* Needed because we may need to move this to memory
in case it's a named return value whose address is taken. */
DECL_REGISTER (DECL_RESULT (subr)) = 1;
More information about the Gcc-patches
mailing list