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, middle_end] Fix PR middle_end/40505


The attached patch fixes PR middle_end/40505.  The PA is a callee copies
target.  We were getting an ICE in expand_expr_addr_expr_1 in certain
C++ code because arguments passed by reference from thunks were not
being copied.

Regression tested on hppa-unknown-linux-gnu, hppa2.0w-hp-hpux11.11 and
hppa64-hp-hpux11.11.

Ok for trunk?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2009-07-01  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	PR middle_end/40505
	calls.c (initialize_argument_information): When passing an argument by
	reference from a thunk, use the same conditions as for callee_copies
	to determine when a copy is needed.

Index: calls.c
===================================================================
--- calls.c	(revision 148752)
+++ calls.c	(working copy)
@@ -1050,12 +1050,11 @@
 
 	  /* If we're compiling a thunk, pass through invisible references
 	     instead of making a copy.  */
-	  if (call_from_thunk_p
-	      || (callee_copies
-		  && !TREE_ADDRESSABLE (type)
-		  && (base = get_base_address (args[i].tree_value))
-		  && TREE_CODE (base) != SSA_NAME
-		  && (!DECL_P (base) || MEM_P (DECL_RTL (base)))))
+	  if ((call_from_thunk_p || callee_copies)
+	      && !TREE_ADDRESSABLE (type)
+	      && (base = get_base_address (args[i].tree_value))
+	      && TREE_CODE (base) != SSA_NAME
+	      && (!DECL_P (base) || MEM_P (DECL_RTL (base))))
 	    {
 	      /* We can't use sibcalls if a callee-copied argument is
 		 stored in the current function's frame.  */


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