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 to assign_parms wrt FUNCTION_ARG_CALLEE_COPIES


Yesterday I noticed that this patch had been sitting in my tree for a
while.  Unfortunately, I don't remember the mail that led me to this piece
of code, nor have I been able to find it by searching.  Was it something
from you, by chance?

In any case, I believe that the patch is demonstrably correct, and should
go in.  The modified section of code wants to know if it needs to make a
copy of the target of an invisible reference.  To make this decision, it
needs the real type of that object.  In the case of invisible references
mandated by the front end, DECL_ARG_TYPE will be a pointer type, the same
as nominal_type, so using it to refer to the target type is broken.
TREE_TYPE (passed_type) gives the target type of the pointer, which is the
type of the object.

Tested x86_64-unknown-linux-gnu, but I'm also going to try and do a testrun
on the PA before checking it in.

2003-11-14  Jason Merrill  <jason@redhat.com>

	* function.c (assign_parms): Use TREE_TYPE to determine the real
	type of the argument object.

*** function.c.~1~	2003-11-13 15:10:44.000000000 -0500
--- function.c	2003-11-13 16:34:06.000000000 -0500
*************** assign_parms (tree fndecl)
*** 4947,4959 ****
  
  	  else if (passed_pointer
  		   && FUNCTION_ARG_CALLEE_COPIES (args_so_far,
! 						  TYPE_MODE (DECL_ARG_TYPE (parm)),
! 						  DECL_ARG_TYPE (parm),
  						  named_arg)
! 		   && ! TREE_ADDRESSABLE (DECL_ARG_TYPE (parm)))
  	    {
  	      rtx copy;
! 	      tree type = DECL_ARG_TYPE (parm);
  
  	      /* This sequence may involve a library call perhaps clobbering
  		 registers that haven't been copied to pseudos yet.  */
--- 4947,4959 ----
  
  	  else if (passed_pointer
  		   && FUNCTION_ARG_CALLEE_COPIES (args_so_far,
! 						  TYPE_MODE (TREE_TYPE (passed_type)),
! 						  TREE_TYPE (passed_type),
  						  named_arg)
! 		   && ! TREE_ADDRESSABLE (TREE_TYPE (passed_type)))
  	    {
  	      rtx copy;
! 	      tree type = TREE_TYPE (passed_type);
  
  	      /* This sequence may involve a library call perhaps clobbering
  		 registers that haven't been copied to pseudos yet.  */

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