[PATCH] D29617: [libFuzzer] Use long long to ensure 64 bits.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 16:15:00 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL294390: [libFuzzer] Use long long to ensure 64 bits. (authored by mpividori).

Changed prior to commit:
  https://reviews.llvm.org/D29617?vs=87356&id=87556#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29617

Files:
  llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp
  llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h
  llvm/trunk/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp


Index: llvm/trunk/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
===================================================================
--- llvm/trunk/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp
+++ llvm/trunk/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: llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h
+++ llvm/trunk/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: llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp
+++ llvm/trunk/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.87556.patch
Type: text/x-patch
Size: 1571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170208/973f3fc0/attachment.bin>


More information about the llvm-commits mailing list