]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nios2: Fix up nios2_setup_incoming_varargs [PR114175]
authorJakub Jelinek <jakub@redhat.com>
Wed, 20 Mar 2024 16:00:08 +0000 (17:00 +0100)
committerJakub Jelinek <jakub@redhat.com>
Sat, 30 Mar 2024 03:53:48 +0000 (04:53 +0100)
Like for x86-64, alpha or rs6000, nios2 seems to be affected too.

Just visually checked differences in c23-stdarg-9.c assembly in a cross
without/with the patch, committed to trunk.

2024-03-20  Jakub Jelinek  <jakub@redhat.com>

PR target/114175
* config/nios2/nios2.cc (nios2_setup_incoming_varargs): Only skip
nios2_function_arg_advance for TYPE_NO_NAMED_ARGS_STDARG_P functions
if arg.type is NULL.

(cherry picked from commit 4c9d2810908004b7e04599b426aca5ee1bd16735)

gcc/config/nios2/nios2.cc

index 936eb34ace4af5ad6ddc6ee54128a9bf627109f8..916324c019b2aa402428c3745f662393ec24d2f2 100644 (file)
@@ -3524,7 +3524,8 @@ nios2_setup_incoming_varargs (cumulative_args_t cum_v,
 
   cfun->machine->uses_anonymous_args = 1;
   local_cum = *cum;
-  if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)))
+  if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl))
+      || arg.type != NULL_TREE)
     nios2_function_arg_advance (local_cum_v, arg);
 
   regs_to_push = NUM_ARG_REGS - local_cum.regs_used;