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: unassignedclangb...@nondot.org
          Reporter: chris.cavala...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to