]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nds32: Fix up nds32_setup_incoming_varargs [PR114175]
authorJakub Jelinek <jakub@redhat.com>
Wed, 20 Mar 2024 15:59:56 +0000 (16:59 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 20 Mar 2024 15:59:56 +0000 (16:59 +0100)
Like for x86-64, alpha or rs6000, nds32 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/nds32/nds32.cc (nds32_setup_incoming_varargs): Only skip
function arg advance for TYPE_NO_NAMED_ARGS_STDARG_P functions
if arg.type is NULL.

gcc/config/nds32/nds32.cc

index 463df8604e08d9c680b331d174a643429d568cbe..f5ea1daad4048a20051afde39f2f2b4d4842dc54 100644 (file)
@@ -2374,7 +2374,8 @@ nds32_setup_incoming_varargs (cumulative_args_t ca,
      for varargs.  */
   total_args_regs
     = NDS32_MAX_GPR_REGS_FOR_ARGS + NDS32_GPR_ARG_FIRST_REGNUM;
-  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)
     num_of_used_regs
       = NDS32_AVAILABLE_REGNUM_FOR_GPR_ARG (cum->gpr_offset, arg.mode, arg.type)
         + NDS32_NEED_N_REGS_FOR_ARG (arg.mode, arg.type);