From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp001-out.apm-internet.net (smtp001-out.apm-internet.net [85.119.248.222]) by sourceware.org (Postfix) with ESMTPS id 383DC3858D1E for ; Fri, 30 Sep 2022 22:50:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 383DC3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=sandoe.co.uk Received: (qmail 68386 invoked from network); 30 Sep 2022 22:50:03 -0000 X-APM-Out-ID: 16645782036837 X-APM-Authkey: 257869/1(257869/1) 5 Received: from unknown (HELO ?192.168.1.95?) (81.138.1.83) by smtp001.apm-internet.net with SMTP; 30 Sep 2022 22:50:03 -0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: [PATCH RFC] c++: fix broken conversion in coroutines From: Iain Sandoe In-Reply-To: <20220930220623.2161990-1-jason@redhat.com> Date: Fri, 30 Sep 2022 23:50:03 +0100 Cc: GCC Patches Content-Transfer-Encoding: quoted-printable Message-Id: <219253A3-8202-4286-9621-982BC5CD24DF@sandoe.co.uk> References: <20220930220623.2161990-1-jason@redhat.com> To: Jason Merrill X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_COUK,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP 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: Hi Jason, > On 30 Sep 2022, at 23:06, Jason Merrill wrote: >=20 > You can't use CONVERT_EXPR to convert between two class types, and it = was > breaking copy elision. >=20 > Unfortunately, this patch breaks symmetric-transfer-00-basic.C, where > susp_type is Loopy::handle_type. How is this supposed to work? We are trying to save a type-erased handle (which the symmetric transfer = makes and indirect call through, nothing else). so, I suppose the equivalent could be: conthand =3D coroutine_handle::from_address (suspend.address()) or, is there some cast version that would be valid here? Iain >=20 > gcc/cp/ChangeLog: >=20 > * coroutines.cc (expand_one_await_expression): Change conversion > to assert. > --- > gcc/cp/coroutines.cc | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc > index eca01abcb7a..568f2edf67d 100644 > --- a/gcc/cp/coroutines.cc > +++ b/gcc/cp/coroutines.cc > @@ -1728,7 +1728,9 @@ expand_one_await_expression (tree *stmt, tree = *await_expr, void *d) > } > else > { > - r =3D build1_loc (loc, CONVERT_EXPR, void_coro_handle_type, = suspend); > + gcc_checking_assert (same_type_ignoring_top_level_qualifiers_p > + (void_coro_handle_type, susp_type)); > + r =3D suspend; > r =3D build2_loc (loc, INIT_EXPR, void_coro_handle_type, = data->conthand, r); > r =3D build1 (CONVERT_EXPR, void_type_node, r); > append_to_statement_list (r, &body_list); >=20 > base-commit: 43faf3e5445b571731e52faa1be085ecd0a09323 > --=20 > 2.31.1 >=20