[all-commits] [llvm/llvm-project] f8b41b: Use a CAS loop for pointer types in __cxx_atomic_f...

Louis Dionne via All-commits all-commits at lists.llvm.org
Tue Jun 16 04:28:15 PDT 2026


  Branch: refs/heads/users/c8ef/atomic_minmax
  Home:   https://github.com/llvm/llvm-project
  Commit: f8b41b52f67d6ca6dd03617efb6d56ec1c20c6ae
      https://github.com/llvm/llvm-project/commit/f8b41b52f67d6ca6dd03617efb6d56ec1c20c6ae
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2026-06-16 (Tue, 16 Jun 2026)

  Changed paths:
    M libcxx/include/__atomic/support/c11.h

  Log Message:
  -----------
  Use a CAS loop for pointer types in __cxx_atomic_fetch_{max,min} on c11.h

Clang's __c11_atomic_fetch_max/min builtins reject pointer arguments
("address argument to atomic operation must be a pointer to atomic integer
or supported floating point type"). The four __cxx_atomic_fetch_{max,min}
overloads in support/c11.h were unconditionally calling those builtins, so
std::atomic<T*>::fetch_max/min failed to compile on every Clang-based
config. support/gcc.h already had this dispatch via #if __has_builtin(...)
falling back to a CAS loop, which is why generic-gcc was passing.

Dispatch on is_pointer<_Tp>::value: pointer types use a CAS loop matching
gcc.h's body, others keep calling the builtin.

Assisted by Claude



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