This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: use hard_function_value



I've checked this in, but I wouldn't mind an expert pair of eyes on
the patch.

This C++ code:

  struct X
  {
  };

  void (X::* fee ())()
  {
   lab: goto lab;
  }

was causing a compiler abort on mips-sgi-irix6.5.  The problem was
that expand_function_start was setting the DECL_RESULT for `fee' to a
BLKmode register, and that hard_reg (via diddle_return_value) unhappy.
I'm not sure exactly how, when, or why this broken -- which makes me
nervous.  It appears that `mips_function_value' has always returned
BLKmode registers in this kind of situation, so I don't know why this
didn't fail ages ago.  In any case, hard_function_value specifically
checks for this case and fixes up the mode of the register, so it
seems sensible to use that function here.

Thanks in advance for any feedback,

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2000-04-17  Mark Mitchell  <mark@codesourcery.com>

	* function.c (expand_function_start): Use hard_function_value to
	compute the RTL to use for DECL_RESULT.

Index: function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.190
diff -c -p -r1.190 function.c
*** function.c	2000/04/12 23:47:06	1.190
--- function.c	2000/04/18 00:02:55
*************** expand_function_start (subr, parms_have_
*** 6182,6194 ****
    else
      /* Scalar, returned in a register.  */
      {
- #ifdef FUNCTION_OUTGOING_VALUE
        DECL_RTL (DECL_RESULT (subr))
! 	= FUNCTION_OUTGOING_VALUE (TREE_TYPE (DECL_RESULT (subr)), subr);
! #else
!       DECL_RTL (DECL_RESULT (subr))
! 	= FUNCTION_VALUE (TREE_TYPE (DECL_RESULT (subr)), subr);
! #endif
  
        /* Mark this reg as the function's return value.  */
        if (GET_CODE (DECL_RTL (DECL_RESULT (subr))) == REG)
--- 6182,6189 ----
    else
      /* Scalar, returned in a register.  */
      {
        DECL_RTL (DECL_RESULT (subr))
! 	= hard_function_value (TREE_TYPE (DECL_RESULT (subr)), subr, 1);
  
        /* Mark this reg as the function's return value.  */
        if (GET_CODE (DECL_RTL (DECL_RESULT (subr))) == REG)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]