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]
Other format: [Raw text]

Patch applied to sh.c: fix struct-return-19 failures



2005-08-18  J"orn Rennecke <joern.rennecke@st.com>

	* sh.c (sh_gimplify_va_arg_expr): Loop to substitute a RECORD_TYPE
	record with the type of its only member.

Index: config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.342
diff -p -r1.342 sh.c
*** config/sh/sh.c	17 Aug 2005 19:44:24 -0000	1.342
--- config/sh/sh.c	18 Aug 2005 16:40:49 -0000
*************** sh_gimplify_va_arg_expr (tree valist, tr
*** 6678,6697 ****
        /* Structures with a single member with a distinct mode are passed
  	 like their member.  This is relevant if the latter has a REAL_TYPE
  	 or COMPLEX_TYPE type.  */
!       if (TREE_CODE (type) == RECORD_TYPE
! 	  && TYPE_FIELDS (type)
! 	  && TREE_CODE (TYPE_FIELDS (type)) == FIELD_DECL
! 	  && (TREE_CODE (TREE_TYPE (TYPE_FIELDS (type))) == REAL_TYPE
! 	      || TREE_CODE (TREE_TYPE (TYPE_FIELDS (type))) == COMPLEX_TYPE)
!           && TREE_CHAIN (TYPE_FIELDS (type)) == NULL_TREE)
  	{
  	  tree field_type = TREE_TYPE (TYPE_FIELDS (type));
  
  	  if (TYPE_MODE (type) == TYPE_MODE (field_type))
  	    type = field_type;
  	  else
! 	    gcc_assert (TYPE_ALIGN (type)
! 			< GET_MODE_ALIGNMENT (TYPE_MODE (field_type)));
  	}
  
        if (TARGET_SH4)
--- 6678,6701 ----
        /* Structures with a single member with a distinct mode are passed
  	 like their member.  This is relevant if the latter has a REAL_TYPE
  	 or COMPLEX_TYPE type.  */
!       while (TREE_CODE (type) == RECORD_TYPE
! 	     && TYPE_FIELDS (type)
! 	     && TREE_CODE (TYPE_FIELDS (type)) == FIELD_DECL
! 	     && (TREE_CODE (TREE_TYPE (TYPE_FIELDS (type))) == REAL_TYPE
! 		 || TREE_CODE (TREE_TYPE (TYPE_FIELDS (type))) == COMPLEX_TYPE
! 		 || TREE_CODE (TREE_TYPE (TYPE_FIELDS (type))) == RECORD_TYPE)
!              && TREE_CHAIN (TYPE_FIELDS (type)) == NULL_TREE)
  	{
  	  tree field_type = TREE_TYPE (TYPE_FIELDS (type));
  
  	  if (TYPE_MODE (type) == TYPE_MODE (field_type))
  	    type = field_type;
  	  else
! 	    {
! 	      gcc_assert (TYPE_ALIGN (type)
! 			  < GET_MODE_ALIGNMENT (TYPE_MODE (field_type)));
! 	    break;
! 	    }
  	}
  
        if (TARGET_SH4)

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