public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Fix C23 (...) functions returning large aggregates [PR114175]
@ 2024-03-18 18:54 Edwin Lu
  2024-03-19  3:07 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Edwin Lu @ 2024-03-18 18:54 UTC (permalink / raw)
  To: gcc-patches; +Cc: gnu-toolchain, Edwin Lu

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
---
 gcc/config/riscv/riscv.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 680c4a728e9..1f5dc33796b 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -5378,7 +5378,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.  */
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RISC-V: Fix C23 (...) functions returning large aggregates [PR114175]
  2024-03-18 18:54 [PATCH] RISC-V: Fix C23 (...) functions returning large aggregates [PR114175] Edwin Lu
@ 2024-03-19  3:07 ` Jeff Law
  2024-03-19 16:57   ` [Committed] " Edwin Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2024-03-19  3:07 UTC (permalink / raw)
  To: Edwin Lu, gcc-patches; +Cc: gnu-toolchain



On 3/18/24 12:54 PM, Edwin Lu wrote:
> 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
OK.  Thanks for taking care of this.

Jeff


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Committed] RISC-V: Fix C23 (...) functions returning large aggregates [PR114175]
  2024-03-19  3:07 ` Jeff Law
@ 2024-03-19 16:57   ` Edwin Lu
  0 siblings, 0 replies; 3+ messages in thread
From: Edwin Lu @ 2024-03-19 16:57 UTC (permalink / raw)
  To: Jeff Law, gcc-patches; +Cc: gnu-toolchain


On 3/18/2024 8:07 PM, Jeff Law wrote:
>
>
> On 3/18/24 12:54 PM, Edwin Lu wrote:
>> 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
> OK.  Thanks for taking care of this.
>
> Jeff
>
Committed!

Edwin


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-19 16:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18 18:54 [PATCH] RISC-V: Fix C23 (...) functions returning large aggregates [PR114175] Edwin Lu
2024-03-19  3:07 ` Jeff Law
2024-03-19 16:57   ` [Committed] " Edwin Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).