diff options
author | Edwin Lu <ewlu@rivosinc.com> | 2024-03-18 11:43:41 -0700 |
---|---|---|
committer | Edwin Lu <ewlu@rivosinc.com> | 2024-03-19 09:55:04 -0700 |
commit | 60586710b0646efdbbd77a7f53b93fb5edb87a61 (patch) | |
tree | baa97df071854553fc483b65420aeb2c4afa5819 /gcc | |
parent | 07e03761a7fc1626a6a74ed957e117f56981558c (diff) | |
download | gcc-60586710b0646efdbbd77a7f53b93fb5edb87a61.zip gcc-60586710b0646efdbbd77a7f53b93fb5edb87a61.tar.gz gcc-60586710b0646efdbbd77a7f53b93fb5edb87a61.tar.bz2 |
RISC-V: Fix C23 (...) functions returning large aggregates [PR114175]
We assume that TYPE_NO_NAMED_ARGS_STDARG_P don't have any named arguments and
there is nothing to advance, but that is not the case for (...) functions
returning by hidden reference which have one such artificial argument.
This causes gcc.dg/c23-stdarg-[68].c to fail
Fix the issue by checking if arg.type is NULL as r14-9503-g218d1749612
explains
Tested on linux rv64gcv.
gcc/ChangeLog:
PR target/114175
* config/riscv/riscv.cc (riscv_setup_incoming_varargs): Only skip
riscv_funciton_arg_advance for TYPE_NO_NAMED_ARGS_STDARG_P functions
if arg.type is NULL
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/riscv/riscv.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 45015ad..02a927f 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -5395,7 +5395,8 @@ riscv_setup_incoming_varargs (cumulative_args_t cum, argument. Advance a local copy of CUM past the last "real" named argument, to find out how many registers are left over. */ local_cum = *get_cumulative_args (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) riscv_function_arg_advance (pack_cumulative_args (&local_cum), arg); /* Found out how many registers we need to save. */ |