public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-9426] Fix internal error on lambda function
@ 2021-03-09 15:24 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2021-03-09 15:24 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6051af8e3db9e6cea79d0e86da0e0dad286f7e4e

commit r10-9426-g6051af8e3db9e6cea79d0e86da0e0dad286f7e4e
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Mar 9 16:12:22 2021 +0100

    Fix internal error on lambda function
    
    This boils down to the RTL expander trying to take the address of a DECL
    whose RTX is a register.
    
    gcc/
            PR c++/90448
            * calls.c (initialize_argument_information): When the argument
            is passed by reference, do not make a copy in a thunk only if
            the argument is already in memory.  Remove redundant test for
            the case of callee copy.

Diff:
---
 gcc/calls.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/gcc/calls.c b/gcc/calls.c
index e0831e9d4b9..26894342c21 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2308,19 +2308,17 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
       function_arg_info arg (type, argpos < n_named_args);
       if (pass_by_reference (args_so_far_pnt, arg))
 	{
-	  bool callee_copies;
-	  tree base = NULL_TREE;
-
-	  callee_copies = reference_callee_copied (args_so_far_pnt, arg);
-
-	  /* 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)))))
+	  const bool callee_copies
+	    = reference_callee_copied (args_so_far_pnt, arg);
+	  tree base;
+
+	  /* If we're compiling a thunk, pass directly the address of an object
+	     already in memory, instead of making a copy.  Likewise if we want
+	     to make the copy in the callee instead of the caller.  */
+	  if ((call_from_thunk_p || callee_copies)
+	      && (base = get_base_address (args[i].tree_value))
+	      && TREE_CODE (base) != SSA_NAME
+	      && (!DECL_P (base) || MEM_P (DECL_RTL (base))))
 	    {
 	      /* We may have turned the parameter value into an SSA name.
 		 Go back to the original parameter so we can take the


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-09 15:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 15:24 [gcc r10-9426] Fix internal error on lambda function Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).