Bootstrapped and tested on x86_64-linux-gnu, but I suspect other
backends will also need to be patched to accomodate.

-- 8< --

Currently, assign_params walks the incoming arguments, but forgets to call
TARGET_FUNCTION_INCOMING_ARG one last time with the end marker, to provide an
opprtunity to finish argument processing. This seems like an oversight.

gcc/ChangeLog:

        * config/i386/i386.cc (ix86_function_arg): Patch up to handle
        function_arg_info::end_marker.
        * function.cc (assign_parms): Call TARGET_FUNCTION_INCOMING_ARG with the
        end maker.
---
 gcc/config/i386/i386.cc | 3 ++-
 gcc/function.cc         | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 15c2d631635..0e3dc4dc2c5 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -3565,7 +3565,8 @@ ix86_function_arg (cumulative_args_t cum_v, const 
function_arg_info &arg)
   HOST_WIDE_INT bytes, words;
   rtx reg;
 
-  if (!cum->caller && cfun->machine->func_type != TYPE_NORMAL)
+  if (!arg.end_marker_p () && !cum->caller
+      && cfun->machine->func_type != TYPE_NORMAL)
     {
       gcc_assert (arg.type != NULL_TREE);
       if (POINTER_TYPE_P (arg.type))
diff --git a/gcc/function.cc b/gcc/function.cc
index 109821c16fc..565e9a9f06f 100644
--- a/gcc/function.cc
+++ b/gcc/function.cc
@@ -3737,6 +3737,9 @@ assign_parms (tree fndecl)
       targetm.calls.function_arg_advance (all.args_so_far, data.arg);
     }
 
+  targetm.calls.function_incoming_arg (all.args_so_far,
+                                       function_arg_info::end_marker ());
+
   if (targetm.calls.split_complex_arg)
     assign_parms_unsplit_complex (&all, fnargs);
 
-- 
2.54.0

Reply via email to