On 11/1/24 12:53 AM, H.J. Lu wrote:
expand_call has

  /* Now possibly adjust the number of named args.
      Normally, don't include the last named arg if anonymous args follow.
      We do include the last named arg if
      targetm.calls.strict_argument_naming() returns nonzero.
      (If no anonymous args follow, the result of list_length is actually
      one too large.  This is harmless.)

      If targetm.calls.pretend_outgoing_varargs_named() returns
      nonzero, and targetm.calls.strict_argument_naming() returns zero,
      this machine will be able to place unnamed args that were passed
      in registers into the stack.  So treat all args as named.  This
      allows the insns emitting for a specific argument list to be
      independent of the function declaration.

      If targetm.calls.pretend_outgoing_varargs_named() returns zero,
      we do not have any reliable way to pass unnamed args in
      registers, so we must force them into memory.  */

   if ((type_arg_types != 0 || TYPE_NO_NAMED_ARGS_STDARG_P (funtype))
       && targetm.calls.strict_argument_naming (args_so_far))
     ;

For non-variadic function, the number of named args is one too large.
Don't include the last named argument for non-variadic function so that
the accurate number of named args can be used.

PR middle-end/117387
* calls.cc (expand_call): Don't include the last named argument
for non-variadic function.
I'm not comfortable changing this in stage3. I realize the patch was submitted while we were still in stage1, but just barely. I'd like to see this resubmitted early in gcc-16 stage1 and with testing beyond just x86 since there's potentially ABI implications here.

jeff

Reply via email to