<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 - Coroutine miscompile"
   href="https://bugs.llvm.org/show_bug.cgi?id=49675">49675</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Coroutine miscompile
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </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>C++2a
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>michal.chojnowski@scylladb.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>clang miscompiles (misoptimizes?) coroutines.

Here's a minimal example for clang 11.0.1: <a href="https://godbolt.org/z/EYE16d">https://godbolt.org/z/EYE16d</a>
Here's a minimal example for both 11.0.1 and trunk:
<a href="https://godbolt.org/z/7nPG39">https://godbolt.org/z/7nPG39</a>

The bug only occurs with optimizations enabled. `opt-bisect-limit` shows that
the linked test cases break after `BISECT: running pass (64) Combine redundant
instructions on function (_Z3foo1A)`. I didn't confirm that this particular
pass is the culprit though; maybe it only makes an earlier miscompile apparent.

Perhaps this bug is not coroutine-specific. However, we have encountered this
miscompile (we aren't certain that the root cause is always the same, but they
all look related) in practice several unrelated times with coroutines, and
never without coroutines.

I also mentioned this case under <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - miscompile with coroutines (aarch64, x86_64)"
   href="show_bug.cgi?id=48857">https://bugs.llvm.org/show_bug.cgi?id=48857</a>,
but I'm opening a separate bug because I'm not actually sure that it's related
to the original case in 48857.</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>