diff options
author | Iain Sandoe <iain@sandoe.co.uk> | 2021-03-02 10:12:58 +0000 |
---|---|---|
committer | Iain Sandoe <iain@sandoe.co.uk> | 2021-03-15 15:48:14 +0000 |
commit | ed8198461735f9b5b3c2cbe50f9913690ce4b4ca (patch) | |
tree | bc006f141a585245c004dab651a040252b7998be /libjava | |
parent | 6f4b0ff2b1fbd58669ae130387c7535110300c52 (diff) | |
download | gcc-ed8198461735f9b5b3c2cbe50f9913690ce4b4ca.zip gcc-ed8198461735f9b5b3c2cbe50f9913690ce4b4ca.tar.gz gcc-ed8198461735f9b5b3c2cbe50f9913690ce4b4ca.tar.bz2 |
coroutines : Avoid generating empty statements [PR96749].
In the compiler-only idiom:
" a = (target expr creats 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).
gcc/cp/ChangeLog:
PR c++/96749
* 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.
gcc/testsuite/ChangeLog:
PR c++/96749
* g++.dg/coroutines/pr96749-1.C: New test.
* g++.dg/coroutines/pr96749-2.C: New test.
Diffstat (limited to 'libjava')
0 files changed, 0 insertions, 0 deletions