[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:45:50 PST 2017
mpividori updated this revision to Diff 87356.
https://reviews.llvm.org/D29617
Files:
lib/Fuzzer/FuzzerTracePC.cpp
lib/Fuzzer/FuzzerValueBitMap.h
lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
Index: lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
===================================================================
--- lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
+++ lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
@@ -14,7 +14,7 @@
uint64_t y;
memcpy(&x, Data, sizeof(x));
memcpy(&y, Data + sizeof(x), sizeof(y));
- if (labs(x) < 0 && y == 0xbaddcafedeadbeefUL) {
+ if (llabs(x) < 0 && y == 0xbaddcafedeadbeefULL) {
printf("BINGO; Found the target, exiting; x = 0x%lx y 0x%lx\n", x, y);
exit(1);
}
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.87356.patch
Type: text/x-patch
Size: 1472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170207/d5817f77/attachment.bin>
More information about the llvm-commits
mailing list