[libFuzzer] ensure that strncmp is not inlined in a test
authorKostya Serebryany <kcc@google.com>
Fri, 31 Mar 2017 03:34:33 +0000 (03:34 +0000)
committerKostya Serebryany <kcc@google.com>
Fri, 31 Mar 2017 03:34:33 +0000 (03:34 +0000)
llvm-svn: 299177

llvm/lib/Fuzzer/test/SingleStrncmpTest.cpp

index dbcc464..e5601da 100644 (file)
@@ -9,7 +9,8 @@
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   char *S = (char*)Data;
-  if (Size >= 6 && !strncmp(S, "qwerty", 6)) {
+  volatile auto Strncmp = &(strncmp);   // Make sure strncmp is not inlined.
+  if (Size >= 6 && !Strncmp(S, "qwerty", 6)) {
     fprintf(stderr, "BINGO\n");
     exit(1);
   }