From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id ECF873858419; Tue, 19 Mar 2024 08:15:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECF873858419 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710836109; bh=pUMD2er77/xLtvRdPDwpa2y1BB547uVCY1kowe8Hr9s=; h=From:To:Subject:Date:From; b=itLjd0UwZiO7+FFlhX9QVud1Y0cC+IxCf54rBnL73kuVyYAfLaH85TiQGGaqej26H z6YmH0Ym/4Yz2CVM/Dh21z8lY7Br6d3KiC0lnZXQ74FYTUHM/eVCiwMETZaY6x1Fqo 7w3Lf7lfc/3hCvHS4x3Rtudzv71Dg+1KY2A8oFyY= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-9536] alpha: Fix alpha_setup_incoming_varargs [PR114175] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: 8f85b46337f90c3126b9cefd72ffd29eb9a4ebf3 X-Git-Newrev: a185d8aeeed7a25a01505565aa61ccf8a876c6ff Message-Id: <20240319081509.ECF873858419@sourceware.org> Date: Tue, 19 Mar 2024 08:15:09 +0000 (GMT) List-Id: https://gcc.gnu.org/g:a185d8aeeed7a25a01505565aa61ccf8a876c6ff commit r14-9536-ga185d8aeeed7a25a01505565aa61ccf8a876c6ff Author: Jakub Jelinek Date: Tue Mar 19 09:14:11 2024 +0100 alpha: Fix alpha_setup_incoming_varargs [PR114175] Like in the r14-9503 change on x86-64, I think Alpha also needs to function_arg_advance after the hidden return pointer argument if any. At least, the following patch changes the assembly of s1-s6 functions on the https://gcc.gnu.org/pipermail/gcc-patches/2024-March/647956.html c23-stdarg-9.c testcase, and eyeballing the assembly for int f8 (...) the ... args are passed in 16..21 registers and then on the stack, while for struct S s8 (...) have hidden return pointer passed in 16 register and ... args in 17..21 registers and then on the stack, and seems without this patch the incoming varargs setup does the wrong thing (but I can't test on alpha easily). Many targets seem to be unaffected, e.g. aarch64, arm, s390*, so I'm not trying to change all targets together because such a change clearly isn't needed e.g. for targets which use special register for the hidden return pointer. 2024-03-19 Jakub Jelinek PR target/114175 * config/alpha/alpha.cc (alpha_setup_incoming_varargs): Only skip function_arg_advance for TYPE_NO_NAMED_ARGS_STDARG_P functions if arg.type is NULL. Diff: --- gcc/config/alpha/alpha.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/config/alpha/alpha.cc b/gcc/config/alpha/alpha.cc index 98df142fb06..1126cea1f7b 100644 --- a/gcc/config/alpha/alpha.cc +++ b/gcc/config/alpha/alpha.cc @@ -6090,7 +6090,8 @@ alpha_setup_incoming_varargs (cumulative_args_t pcum, { CUMULATIVE_ARGS cum = *get_cumulative_args (pcum); - 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) /* Skip the current argument. */ targetm.calls.function_arg_advance (pack_cumulative_args (&cum), arg);