https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117387
Bug ID: 117387
Summary: Incorrect n_named_args in expand_call
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
expand_call has
if (type_arg_types != 0)
n_named_args
= (list_length (type_arg_types)
/* Count the struct value address, if it is passed as a parm. */
+ structure_value_addr_parm);
else if (TYPE_NO_NAMED_ARGS_STDARG_P (funtype))
n_named_args = structure_value_addr_parm;
else
/* If we know nothing, treat all args as named. */
n_named_args = num_actuals;
Since void_list_node is placed at the end of a parameter list to indicate that
the function does not take a variable number of arguments and the last
TREE_VALUE will be void_type_node, for non-variadic function, n_named_args
is off by 1.