On 3/14/21 8:17 PM, Iain Sandoe wrote:
Hi

In the compiler-only idiom:
" a = (target expr creates temp, op uses temp)"
the target expression variable needs to be promoted to a frame one
(if the expression has a suspend point).  However, the only uses of
the var are in the second part of the compound expression - and we
were creating an empty statement corresponding to the (now unused)
first arm.  This then produces the spurious warnings noted.

Fixed by avoiding generation of a separate variable nest for
isolated target expressions (or similarly isolated co_awaits used
in a function call).

tested on x86_64-darwin, x86_64-linux-gnu
and with cppcoro and folly/coroutines

OK for master/10.x?
thanks
Iain

gcc/cp/ChangeLog:

         * coroutines.cc (flatten_await_stmt): Allow for the case
         where a target expression variable only has uses in the
         second part of a compound expression.
         (maybe_promote_temps): Avoid emiting empty statements.



ok



--
Nathan Sidwell

Reply via email to