<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Clang implementation of _InterlockedAnd in intrin.h doesn't follow official behavior"
   href="https://llvm.org/bugs/show_bug.cgi?id=28326">28326</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang implementation of _InterlockedAnd in intrin.h doesn't follow official behavior
          </td>
        </tr>

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

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

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>Headers
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>chris.cavalaria@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Looking at the source of intrin.h
(<a href="https://github.com/llvm-mirror/clang/blob/c0be6ec1bf4aeb27228c27cd807c3d4a9b759c4a/lib/Headers/intrin.h">https://github.com/llvm-mirror/clang/blob/c0be6ec1bf4aeb27228c27cd807c3d4a9b759c4a/lib/Headers/intrin.h</a>
for the most recent version) I can see that _InterlockedAnd is implemented with
a call to __atomic_and_fetch which if I'm not wrong returns the value in the
variable after then "and" is done. But the MSDN suggests it should return the
value before the "and"

<a href="https://msdn.microsoft.com/en-us/library/dsx2t7yd.aspx">https://msdn.microsoft.com/en-us/library/dsx2t7yd.aspx</a>

Return Value
The original value of the first operand.


It should probably be a call to __atomic_fetch_and instead.</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>