[LLVMbugs] [Bug 20546] New: atomic_compare_exchange_weak tests fail spuriously

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 5 11:12:06 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20546

            Bug ID: 20546
           Summary: atomic_compare_exchange_weak tests fail spuriously
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: danalbert at google.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

So far I've only seen this on ARM, but it looks like it's actually an error in
the tests rather than the implementation.

According to 29.6.5.25:

"Remark: A weak compare-and-exchange operation may fail spuriously. That is,
even when the contents of memory referred to by expected and object are equal,
it may return false and store back to expected the same memory contents that
were originally there. [ Note: This spurious failure enables implementation of
compare and-exchange on a broader class of machines, e.g., load-locked
store-conditional machines. A consequence of spurious failure is that nearly
all uses of weak compare-and-exchange will be in a loop"

Our tests have these calls used outside of a loop.

Two examples:
test/atomics/atomics.types.generic/integral.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp

-- 
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/20140805/9f97d82b/attachment.html>


More information about the llvm-bugs mailing list