[Bug target/94359] new test case g++.dg/coroutines/torture/symmetric-transfer-00-basic.C fails

iains at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 9 20:40:46 GMT 2020


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

--- Comment #11 from Iain Sandoe <iains at gcc dot gnu.org> ---
Created attachment 48251
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48251&action=edit
Patch for testing

coroutines: Fix compile error with symmetric transfers [PR94359]

For symmetric transfers to work with C++20 coroutines, it is
currently necessary to tail call the callee coroutine from resume
method of the caller coroutine.  The current codegen marks these
resume calls as "MUST_TAIL_CALL" to indicate that the tail call is
required for correctness, in the general case.

Unfortunately, several targets have ABI constraints that prevent
an indirect tail-call, which results in the PRs compile error.

The change here tests the target sibcall hook for the resume
expression and only marks it as requiring a tail call if that's
supported.

This doesn't fix the underlying problem; that really a solution is
needed to allow the tail-calls (or equivalent) to take place - but
that will be deferred until next stage 1.

The test case is 'xfail-run-if'd for the targets mentioned in this
PR since we still want to test that the compile proceeds without
error.  At compile-time we can't tell if missing the tail-call will
cause a specific code to fail, so that most likely a warning for this
case would produce a lot of false positives.


gcc/cp/ChangeLog:

2020-04-09  Iain Sandoe  <iain@sandoe.co.uk>

        PR c++/94359
        * coroutines.cc (build_actor_fn): Check that the target can
        support the resume tail-call before mandating it.

gcc/testsuite/ChangeLog:

2020-04-09  Iain Sandoe  <iain@sandoe.co.uk>

        PR c++/94359
        * g++.dg/coroutines/torture/symmetric-transfer-00-basic.C:
        Expect a run fail for targets without indirect tail-calls.


More information about the Gcc-bugs mailing list