[PATCH] D150985: [clang] Allow fp in atomic fetch max/min builtins

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 31 10:34:11 PDT 2023


tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

LGTM with few more test nits.



================
Comment at: clang/test/Sema/atomic-ops.c:134
        int *I, const int *CI,
        int **P, float *D, struct S *s1, struct S *s2) {
   __c11_atomic_init(I, 5); // expected-error {{pointer to _Atomic}}
----------------
I wonder why we have this inconsistency in the non-atomic arguments.
We don't actually have any double variants and the argument `D` is actually a `float *`, even though the naming convention used suggests that it should've been either a `double *` or should be called `F`.



================
Comment at: clang/test/Sema/atomic-ops.c:218
   __atomic_fetch_sub(s1, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer, pointer or supported floating point type}}
-  __atomic_fetch_min(D, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}}
-  __atomic_fetch_max(P, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}}
+  __atomic_fetch_min(D, 3, memory_order_seq_cst);
+  __atomic_fetch_max(P, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer or supported floating point type}}
----------------
We seem to be missing the tests for `double *` here, too.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150985/new/

https://reviews.llvm.org/D150985



More information about the cfe-commits mailing list