[llvm-bugs] [Bug 28326] New: Clang implementation of _InterlockedAnd in intrin.h doesn't follow official behavior

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 27 05:47:43 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28326

            Bug ID: 28326
           Summary: Clang implementation of _InterlockedAnd in intrin.h
                    doesn't follow official behavior
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Headers
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chris.cavalaria at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Looking at the source of intrin.h
(https://github.com/llvm-mirror/clang/blob/c0be6ec1bf4aeb27228c27cd807c3d4a9b759c4a/lib/Headers/intrin.h
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"

https://msdn.microsoft.com/en-us/library/dsx2t7yd.aspx

Return Value
The original value of the first operand.


It should probably be a call to __atomic_fetch_and instead.

-- 
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/20160627/ce57649c/attachment.html>


More information about the llvm-bugs mailing list