From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 709433858D35 for ; Tue, 19 Mar 2024 08:45:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 709433858D35 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 709433858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=89.208.246.23 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710837940; cv=none; b=Shd3oCRc148zZW9Y6/PPQ/b9QMRiMA2SNhA3xnDd6TaHMsXvoWeGUZF703E2fq254Vp89G7ZzAtkHjXnCBk6Bu7oxovxhiWw9y+sqaU1DnmOtVVOczwN4wMn7fgMnwLSL1ODYevp4KgTKClmwmWJL+cNP6UCnpboEHxG2uTfr5k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710837940; c=relaxed/simple; bh=JMqXoL0pCrGEz2ryKusB4JUD9WhRiE3DvmcVqR+kH1k=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=COrm+l58edkKLlezZw8YHn0Wr6bd2kOMTjggMvWVwMHzu1qatgapeOzK+W7aOjEBfNj+VQ+lyV/bpeCKHnVQi54CroLUsyOEFhETI3a9pHhCkn9d24puwIuY7NtZssOCI805MwRq4BEEkHCGxshKhp8nqKBofCrq7HQKwTC5ViA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1710837932; bh=JMqXoL0pCrGEz2ryKusB4JUD9WhRiE3DvmcVqR+kH1k=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=PNUqcPTPwLTWoeC5cvxeGKuS0htvi0KSK3U+ADlCWMkxwEL1XyFNXk+k5Xv5GhYz8 Hp/qLtYeH2GoEAQzUy3AGbDQJTNv54zUBFpd3TPvpo1Q/GUkL+TFtc7m5ApqGqhM9k 8tMhrDihy/bTqBSBlizzGQXdm4XRixWTb7i+AdqQ= Received: from [IPv6:240e:358:11e9:1a00:dc73:854d:832e:6] (unknown [IPv6:240e:358:11e9:1a00:dc73:854d:832e:6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 04CF866DDC; Tue, 19 Mar 2024 04:45:29 -0400 (EDT) Message-ID: <1a970fe50291e376e745b7730df2a24ad7ee20b1.camel@xry111.site> Subject: Pushed: [PATCH v2] LoongArch: Fix C23 (...) functions returning large aggregates [PR114175] From: Xi Ruoyao To: chenglulu , gcc-patches@gcc.gnu.org Cc: i@xen0n.name, xuchenghua@loongson.cn Date: Tue, 19 Mar 2024 16:45:25 +0800 In-Reply-To: <22cec797-4686-d1e0-e1f8-0d7af968a92b@loongson.cn> References: <20240318093510.9520-1-xry111@xry111.site> <22cec797-4686-d1e0-e1f8-0d7af968a92b@loongson.cn> Content-Type: multipart/mixed; boundary="=-aRIb0BqtLwnG8CC+9ChF" User-Agent: Evolution 3.52.0 MIME-Version: 1.0 X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,LIKELY_SPAM_FROM,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --=-aRIb0BqtLwnG8CC+9ChF Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2024-03-19 at 11:19 +0800, chenglulu wrote: >=20 > =E5=9C=A8 2024/3/18 =E4=B8=8B=E5=8D=885:34, Xi Ruoyao =E5=86=99=E9=81=93: > > We were assuming 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.=C2=A0 This is causing gcc.dg/c23-stdarg-6.c and > > gcc.dg/c23-stdarg-8.c to fail. > >=20 > > Fix the issue by checking if arg.type is NULL, as r14-9503 explains. > >=20 > > gcc/ChangeLog: > >=20 > > PR target/114175 > > * config/loongarch/loongarch.cc > > (loongarch_setup_incoming_varargs): Only skip > > loongarch_function_arg_advance for > > TYPE_NO_NAMED_ARGS_STDARG_P > > functions if arg.type is NULL. > > --- > >=20 > > Bootstrapped and regtested on loongarch64-linux-gnu.=C2=A0 Ok for trunk= ? > >=20 > > =C2=A0 gcc/config/loongarch/loongarch.cc | 3 ++- > > =C2=A0 1 file changed, 2 insertions(+), 1 deletion(-) > >=20 > > diff --git a/gcc/config/loongarch/loongarch.cc > > b/gcc/config/loongarch/loongarch.cc > > index 70e31bb831c..57de8ef7d20 100644 > > --- a/gcc/config/loongarch/loongarch.cc > > +++ b/gcc/config/loongarch/loongarch.cc > > @@ -767,7 +767,8 @@ loongarch_setup_incoming_varargs > > (cumulative_args_t cum, > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 argument.=C2=A0 Advance a local co= py of CUM past the last "real" > > named > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 argument, to find out how many reg= isters are left over.=C2=A0 */ > > =C2=A0=C2=A0=C2=A0 local_cum =3D *get_cumulative_args (cum); > I think it's important to add annotation information here: > =C2=A0=C2=A0=C2=A0=C2=A0 /* where there is no hidden return argument pass= ed, arg.type >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 is always NULL.=C2=A0 */ >=20 > Others LTGM. >=20 > Thanks! Pushed v2 with a comment added as attached. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University --=-aRIb0BqtLwnG8CC+9ChF Content-Disposition: attachment; filename*0=v2-0001-LoongArch-Fix-C23-.-functions-returning-large-agg.pat; filename*1=ch Content-Type: text/x-patch; name="v2-0001-LoongArch-Fix-C23-.-functions-returning-large-agg.patch"; charset="UTF-8" Content-Transfer-Encoding: base64 RnJvbSBjMWZkNDU4OWMyYmY5ZmQ4NDA5ZDUxYjk0ZGYyMTljYjc1MTA3NzYyIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBYaSBSdW95YW8gPHhyeTExMUB4cnkxMTEuc2l0ZT4KRGF0ZTog TW9uLCAxOCBNYXIgMjAyNCAxNzoxODozNCArMDgwMApTdWJqZWN0OiBbUEFUQ0ggdjJdIExvb25n QXJjaDogRml4IEMyMyAoLi4uKSBmdW5jdGlvbnMgcmV0dXJuaW5nIGxhcmdlCiBhZ2dyZWdhdGVz IFtQUjExNDE3NV0KCldlIHdlcmUgYXNzdW1pbmcgVFlQRV9OT19OQU1FRF9BUkdTX1NUREFSR19Q IGRvbid0IGhhdmUgYW55IG5hbWVkCmFyZ3VtZW50cyBhbmQgdGhlcmUgaXMgbm90aGluZyB0byBh ZHZhbmNlLCBidXQgdGhhdCBpcyBub3QgdGhlIGNhc2UKZm9yICguLi4pIGZ1bmN0aW9ucyByZXR1 cm5pbmcgYnkgaGlkZGVuIHJlZmVyZW5jZSB3aGljaCBoYXZlIG9uZSBzdWNoCmFydGlmaWNpYWwg YXJndW1lbnQuICBUaGlzIGlzIGNhdXNpbmcgZ2NjLmRnL2MyMy1zdGRhcmctNi5jIGFuZApnY2Mu ZGcvYzIzLXN0ZGFyZy04LmMgdG8gZmFpbC4KCkZpeCB0aGUgaXNzdWUgYnkgY2hlY2tpbmcgaWYg YXJnLnR5cGUgaXMgTlVMTCwgYXMgcjE0LTk1MDMgZXhwbGFpbnMuCgpnY2MvQ2hhbmdlTG9nOgoK CVBSIHRhcmdldC8xMTQxNzUKCSogY29uZmlnL2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