public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <iain@sandoe.co.uk>
To: Jason Merrill <jason@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH RFC] c++: fix broken conversion in coroutines
Date: Fri, 30 Sep 2022 23:50:03 +0100	[thread overview]
Message-ID: <219253A3-8202-4286-9621-982BC5CD24DF@sandoe.co.uk> (raw)
In-Reply-To: <20220930220623.2161990-1-jason@redhat.com>

Hi Jason,

> On 30 Sep 2022, at 23:06, Jason Merrill <jason@redhat.com> wrote:
> 
> You can't use CONVERT_EXPR to convert between two class types, and it was
> breaking copy elision.
> 
> Unfortunately, this patch breaks symmetric-transfer-00-basic.C, where
> susp_type is Loopy<int>::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 = coroutine_handle::from_address (suspend.address())

or, is there some cast version that would be valid here?
Iain

> 
> gcc/cp/ChangeLog:
> 
> 	* coroutines.cc (expand_one_await_expression): Change conversion
> 	to assert.
> ---
> gcc/cp/coroutines.cc | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 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 = 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 = suspend;
>       r = build2_loc (loc, INIT_EXPR, void_coro_handle_type, data->conthand, r);
>       r = build1 (CONVERT_EXPR, void_type_node, r);
>       append_to_statement_list (r, &body_list);
> 
> base-commit: 43faf3e5445b571731e52faa1be085ecd0a09323
> -- 
> 2.31.1
> 


  reply	other threads:[~2022-09-30 22:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30 22:06 Jason Merrill
2022-09-30 22:50 ` Iain Sandoe [this message]
2022-10-04  3:53   ` Jason Merrill
2022-10-06 21:44     ` Jason Merrill
2022-10-06 22:47       ` Iain Sandoe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=219253A3-8202-4286-9621-982BC5CD24DF@sandoe.co.uk \
    --to=iain@sandoe.co.uk \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).