[llvm-bugs] [Bug 43069] New: [coroutines] musttail and -fstack-protector-all interactions don't mix well

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 20 21:08:26 PDT 2019


            Bug ID: 43069
           Summary: [coroutines] musttail and -fstack-protector-all
                    interactions don't mix well
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedbugs at nondot.org
          Reporter: gornishanov at gmail.com
                CC: llvm-bugs at lists.llvm.org

In this example, stack-protector-all will insert code before the return that
will prevent symmetric coroutine transfer.

Due to bug#1 it will result in stack overflow when symmetric transfer is
required for correctness.

With bug#1 fixed, the code will fail to compile, since musttail won't be


// -O2 -stdlib=libc++ -std=c++2a -fstack-protector-all
// Bug#1, [coroutines] CoroSplit fails to add musttaill under -O2)
// Bug#2, fstack-protector-all interactions prevent tail call (this bug)
#include <experimental/coroutine>
using namespace std::experimental;

struct coro {
  struct promise_type {
    suspend_always initial_suspend() { return {}; }
    suspend_always final_suspend() { return {}; }
    void return_void() {}
    void unhandled_exception(){}
    coro get_return_object() { return{};}
coroutine_handle<> h;
struct sym {
  bool await_ready() { return false; }
  void await_resume() {}
  auto await_suspend(coroutine_handle<>) { return h; }
coro f() { co_await sym{}; }

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190821/a0fbd7e3/attachment.html>

More information about the llvm-bugs mailing list