https://gcc.gnu.org/g:91092c30eda6777e33705a66a2c3049d4a18569d

commit r13-8517-g91092c30eda6777e33705a66a2c3049d4a18569d
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Mar 20 16:59:56 2024 +0100

    nds32: Fix up nds32_setup_incoming_varargs [PR114175]
    
    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  <ja...@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.
    
    (cherry picked from commit b22a9c7dd29a14a217de8b86d3e100e4e8b7785e)

Diff:
---
 gcc/config/nds32/nds32.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/nds32/nds32.cc b/gcc/config/nds32/nds32.cc
index 91ed91d914f..1f41bf81ad8 100644
--- a/gcc/config/nds32/nds32.cc
+++ b/gcc/config/nds32/nds32.cc
@@ -2377,7 +2377,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);

Reply via email to