https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95736

Lewis Baker <lewissbaker.opensource at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lewissbaker.opensource@gmai
                   |                            |l.com

--- Comment #1 from Lewis Baker <lewissbaker.opensource at gmail dot com> ---
I've also investigated this a bit more and have annotated the assembly of the
code being generated by GCC in this example (slightly modified).

https://godbolt.org/z/_HJNHC

Immediately before the 'co_await foo' expression the compiler generates
a copy of the this->foo member into the coroutine frame. But it does
this doing the equivalent of a memcpy() rather than calling the
copy-constructor.

The compiler should not be making this copy of the operand to 'co_await'
and should instead be passing the address of the 'this->foo' member to the
as the implicit object parameter in the call to
await_ready/await_suspend/await_resume.

Reply via email to