[all-commits] [llvm/llvm-project] 3fea2f: [libc++][test] Use loop with compare_exchange_weak...

Jake Egan via All-commits all-commits at lists.llvm.org
Sat Mar 14 19:35:09 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3fea2f61652e10c7f3abc17f0542e8bc0dd0ea25
      https://github.com/llvm/llvm-project/commit/3fea2f61652e10c7f3abc17f0542e8bc0dd0ea25
  Author: Jake Egan <Jake.egan at ibm.com>
  Date:   2026-03-14 (Sat, 14 Mar 2026)

  Changed paths:
    M libcxx/test/std/atomics/atomics.ref/compare_exchange_weak.pass.cpp

  Log Message:
  -----------
  [libc++][test] Use loop with compare_exchange_weak calls (#185953)

On AIX, this test sometimes fails with error `Assertion failed: y ==
true`. The test assumes `compare_exchange_weak` should succeed on a
single call, however according to the standard:

> A weak compare-and-exchange operation may fail spuriously. That is,
even when the contents of memory referred to by expected and ptr are
equal, it may return false and store back to expected the same memory
contents that were originally there.
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.

[atomics.ref.ops]/27



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list