[all-commits] [llvm/llvm-project] fed564: [Sema] atomic_compare_exchange: check failure memo...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Dec 14 11:03:41 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fed564432cef76f8b303c19ab1dfc0a14878fbc3
      https://github.com/llvm/llvm-project/commit/fed564432cef76f8b303c19ab1dfc0a14878fbc3
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-12-14 (Thu, 14 Dec 2023)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/Sema/atomic-ops.c
    M clang/test/SemaCUDA/atomic-ops.cu

  Log Message:
  -----------
  [Sema] atomic_compare_exchange: check failure memory order (#74959)

For

`__atomic_compare_exchange{,_n}/__c11_atomic_compare_exchange_{strong,weak}`,
GCC checks both the success memory order and the failure memory order
under the default -Winvalid-memory-model ("memory model" is confusing
here and "memory order" is much more common in the atomic context).

* The failure memory order, if a constant, must be one of
  relaxed/consume/acquire/seq_cst.

Clang checks just the success memory order under the default
-Watomic-memory-ordering. This patch checks the failure memory order.




More information about the All-commits mailing list