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

--- Comment #14 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Iain Sandoe from comment #13)
> (In reply to H.J. Lu from comment #12)
> > (In reply to Iain Sandoe from comment #5)
> > > well .. the visible difference in gimple, but this is code outside of the
> > > coroutines changes (i.e. just a bit of regular C++).
> > > 
> > > However, it does seem we create the return object correctly .. and then
> > > return an empty one.  We seem to be failing to do copy elision.
> > > 
> > 
> > On x32, OptionalPromiseReturn is 16 bytes, which is returned in 2 registers.
> > You can't assume that copy elision will happen.  You need to prepare for it.
> 
> Hmm .. but I think copy elision is mandated by c++17 - so we need to figure
> out a solution< i guess.

There is no guarantee that all ABIs will pass and return struct in the same
location, stack or register.  I don't see how a high level language can
mandate copy elision for the incoming argument on stack and the return value in
registers.  Copy elision won't happen on x64-64 if the return struct size is 16
bytes or less.

Reply via email to