[compiler-rt] 336e886 - [sanitizer] Fix test on Windows
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 12 13:31:45 PDT 2021
Author: Vitaly Buka
Date: 2021-10-12T13:24:40-07:00
New Revision: 336e88636a99c18a4747cb06ad1bc9b590901482
URL: https://github.com/llvm/llvm-project/commit/336e88636a99c18a4747cb06ad1bc9b590901482
DIFF: https://github.com/llvm/llvm-project/commit/336e88636a99c18a4747cb06ad1bc9b590901482.diff
LOG: [sanitizer] Fix test on Windows
UL suffix on MSVC is 32bit.
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
index 309be54a7b34..397f19bedb9f 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
@@ -106,7 +106,7 @@ StackDepotBase<Node, kReservedBits, kTabSizeLog>::Put(args_type args,
hash_type h = Node::hash(args);
atomic_uintptr_t *p = &tab[h % kTabSize];
uptr v = atomic_load(p, memory_order_consume);
- Node *s = (Node *)(v & ~1);
+ Node *s = (Node *)(v & ~uptr(1));
// First, try to find the existing stack.
Node *node = find(s, args, h);
if (LIKELY(node))
@@ -150,7 +150,7 @@ StackDepotBase<Node, kReservedBits, kTabSizeLog>::Get(u32 id) {
CHECK_LT(idx, kTabSize);
atomic_uintptr_t *p = &tab[idx];
uptr v = atomic_load(p, memory_order_consume);
- Node *s = (Node *)(v & ~1);
+ Node *s = (Node *)(v & ~uptr(1));
for (; s; s = s->link) {
if (s->id == id) {
return s->load();
@@ -172,7 +172,7 @@ void StackDepotBase<Node, kReservedBits, kTabSizeLog>::UnlockAll() {
for (int i = 0; i < kTabSize; ++i) {
atomic_uintptr_t *p = &tab[i];
uptr s = atomic_load(p, memory_order_relaxed);
- unlock(p, (Node *)(s & ~1UL));
+ unlock(p, (Node *)(s & ~uptr(1)));
}
}
@@ -181,7 +181,7 @@ void StackDepotBase<Node, kReservedBits, kTabSizeLog>::PrintAll() {
for (int i = 0; i < kTabSize; ++i) {
atomic_uintptr_t *p = &tab[i];
uptr v = atomic_load(p, memory_order_consume);
- Node *s = (Node *)(v & ~1UL);
+ Node *s = (Node *)(v & ~uptr(1));
for (; s; s = s->link) {
Printf("Stack for id %u:\n", s->id);
s->load().Print();
More information about the llvm-commits
mailing list