From: Olivier Dion Date: Thu, 21 Sep 2023 20:16:21 +0000 (-0400) Subject: rculfhash: Only pass integral types to atomic builtins X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=dad4e6b76774924762a4eb56def7fbaee38d7653;p=userspace-rcu.git rculfhash: Only pass integral types to atomic builtins Clang expects the pointers passed to atomic builtins to be integral. Fix this by casting nodes address to uintptr_t *. Change-Id: Ifb8833c493df849a542a22f0bb2baeeb85be0297 Signed-off-by: Olivier Dion Signed-off-by: Mathieu Desnoyers --- diff --git a/src/rculfhash.c b/src/rculfhash.c index 09cd2b7..a453326 100644 --- a/src/rculfhash.c +++ b/src/rculfhash.c @@ -1153,7 +1153,7 @@ int _cds_lfht_del(struct cds_lfht *ht, unsigned long size, struct cds_lfht_node *node) { struct cds_lfht_node *bucket, *next; - struct cds_lfht_node **node_next; + uintptr_t *node_next; if (!node) /* Return -ENOENT if asked to delete NULL node */ return -ENOENT; @@ -1185,7 +1185,7 @@ int _cds_lfht_del(struct cds_lfht *ht, unsigned long size, * NOTE: The node_next variable is present to avoid breaking * strict-aliasing rules. */ - node_next = &node->next; + node_next = (uintptr_t*)&node->next; uatomic_or_mo(node_next, REMOVED_FLAG, CMM_RELEASE); /* We performed the (logical) deletion. */ @@ -1426,7 +1426,7 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i, for (j = size + start; j < size + start + len; j++) { struct cds_lfht_node *fini_bucket = bucket_at(ht, j); struct cds_lfht_node *parent_bucket = bucket_at(ht, j - size); - struct cds_lfht_node **fini_bucket_next; + uintptr_t *fini_bucket_next; urcu_posix_assert(j >= size && j < (size << 1)); dbg_printf("remove entry: order %lu index %lu hash %lu\n", @@ -1436,7 +1436,7 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i, * NOTE: The fini_bucket_next variable is present to * avoid breaking strict-aliasing rules. */ - fini_bucket_next = &fini_bucket->next; + fini_bucket_next = (uintptr_t*)&fini_bucket->next; uatomic_or(fini_bucket_next, REMOVED_FLAG); _cds_lfht_gc_bucket(parent_bucket, fini_bucket); }