<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [coroutines] musttail and -fstack-protector-all interactions don't mix well"
   href="https://bugs.llvm.org/show_bug.cgi?id=43069">43069</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[coroutines] musttail and -fstack-protector-all interactions don't mix well
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Transformation Utilities
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>gornishanov@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In this example, stack-protector-all will insert code before the return that
will prevent symmetric coroutine transfer.

Due to <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Need to add product version numbers"
   href="show_bug.cgi?id=1">bug#1</a> it will result in stack overflow when symmetric transfer is
required for correctness.

With <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Need to add product version numbers"
   href="show_bug.cgi?id=1">bug#1</a> fixed, the code will fail to compile, since musttail won't be
honored.

<a href="https://godbolt.org/z/7T_YnR">https://godbolt.org/z/7T_YnR</a>

// -O2 -stdlib=libc++ -std=c++2a -fstack-protector-all
// <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Need to add product version numbers"
   href="show_bug.cgi?id=1">Bug#1</a>, [coroutines] CoroSplit fails to add musttaill under -O2)
// <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Customize Bugzilla to have some LLVM flavah"
   href="show_bug.cgi?id=2">Bug#2</a>, 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{}; }</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>