]> gcc.gnu.org Git - gcc.git/commit
coroutines: Improve error recovery [PR94817, PR94829].
authorIain Sandoe <iain@sandoe.co.uk>
Thu, 7 May 2020 18:48:31 +0000 (19:48 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Thu, 7 May 2020 20:06:43 +0000 (21:06 +0100)
commitc7100843831147a034fe37d231c54ac53ceace45
treecfd8d1b58df219af0386ac27e2e3dfabd17b7226
parentf1d9467714a6dfcb8791037e502f84df927d0084
coroutines: Improve error recovery [PR94817, PR94829].

When we have completely missing key information (e.g. the
coroutine_traits) or a partially transformed function body, we
need to try and balance returning useful information about
failures with the possibility that some part of the diagnostics
machinery or following code will not be able to handle the
state.

The PRs (and revised testcase) point to cases where that processing
has failed.

This revises the process to avoid special handling for the
ramp, and falls back on the same code used for regular function
fails.

There are test-cases (in addition to the ones for the PRs) that now
cover all early exit points [where the transforms are considered
to have failed in a manner that does not allow compilation to
continue].

gcc/cp/ChangeLog:

2020-05-07  Iain Sandoe  <iain@sandoe.co.uk>

PR c++/94817
PR c++/94829
* coroutines.cc (morph_fn_to_coro): Set unformed outline
functions to error_mark_node.  For early error returns suppress
warnings about missing ramp return values.  Fix reinstatement
of the function body on pre-existing initial error.
* decl.c (finish_function): Use the normal error path for fails
in the ramp function, do not try to compile the helpers if the
transform fails.

gcc/testsuite/ChangeLog:

2020-05-07  Iain Sandoe  <iain@sandoe.co.uk>

PR c++/94817
PR c++/94829
* g++.dg/coroutines/coro-missing-final-suspend.C: New test.
* g++.dg/coroutines/coro-missing-initial-suspend.C: New test.
* g++.dg/coroutines/coro-missing-promise-yield.C: Check for
continuation of compilation.
* g++.dg/coroutines/coro-missing-promise.C: Likewise.
* g++.dg/coroutines/coro-missing-ret-value.C: Likewise
* g++.dg/coroutines/coro-missing-ret-void.C: Likewise
* g++.dg/coroutines/coro-missing-ueh-3.C: Likewise
* g++.dg/coroutines/pr94817.C: New test.
* g++.dg/coroutines/pr94829.C: New test.
14 files changed:
gcc/cp/ChangeLog
gcc/cp/coroutines.cc
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/coroutines/coro-missing-final-suspend.C [new file with mode: 0644]
gcc/testsuite/g++.dg/coroutines/coro-missing-initial-suspend.C [new file with mode: 0644]
gcc/testsuite/g++.dg/coroutines/coro-missing-promise-yield.C
gcc/testsuite/g++.dg/coroutines/coro-missing-promise.C
gcc/testsuite/g++.dg/coroutines/coro-missing-ret-value.C
gcc/testsuite/g++.dg/coroutines/coro-missing-ret-void.C
gcc/testsuite/g++.dg/coroutines/coro-missing-ueh-3.C
gcc/testsuite/g++.dg/coroutines/coro1-ret-int-yield-int.h
gcc/testsuite/g++.dg/coroutines/pr94817.C [new file with mode: 0644]
gcc/testsuite/g++.dg/coroutines/pr94829.C [new file with mode: 0644]
This page took 0.059791 seconds and 5 git commands to generate.