[PATCH] D29617: [libFuzzer] Use long long to ensure 64 bits.
Marcos Pividori via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 6 18:43:50 PST 2017
mpividori created this revision.
We need to always use `unsigned long long` to ensure 64 bits. On Windows, `unsigned long` is 4 bytes.
This was the reason why `value-profile-cmp4.test` was failing on Windows.
https://reviews.llvm.org/D29617
Files:
lib/Fuzzer/FuzzerTracePC.cpp
lib/Fuzzer/FuzzerValueBitMap.h
Index: lib/Fuzzer/FuzzerValueBitMap.h
===================================================================
--- lib/Fuzzer/FuzzerValueBitMap.h
+++ lib/Fuzzer/FuzzerValueBitMap.h
@@ -68,7 +68,7 @@
Other.Map[i] = 0;
}
if (M)
- Res += __builtin_popcountl(M);
+ Res += __builtin_popcountll(M);
}
NumBits = Res;
return OldNumBits < NumBits;
Index: lib/Fuzzer/FuzzerTracePC.cpp
===================================================================
--- lib/Fuzzer/FuzzerTracePC.cpp
+++ lib/Fuzzer/FuzzerTracePC.cpp
@@ -273,7 +273,7 @@
ATTRIBUTE_NO_SANITIZE_ALL
void TracePC::HandleCmp(uintptr_t PC, T Arg1, T Arg2) {
uint64_t ArgXor = Arg1 ^ Arg2;
- uint64_t ArgDistance = __builtin_popcountl(ArgXor) + 1; // [1,65]
+ uint64_t ArgDistance = __builtin_popcountll(ArgXor) + 1; // [1,65]
uintptr_t Idx = ((PC & 4095) + 1) * ArgDistance;
if (sizeof(T) == 4)
TORC4.Insert(ArgXor, Arg1, Arg2);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29617.87354.patch
Type: text/x-patch
Size: 949 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170207/0731456c/attachment.bin>
More information about the llvm-commits
mailing list