[PATCH] D50194: LLVM Proto Fuzzer - Run Functions on Suite of Inputs

Matt Morehouse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 2 11:18:25 PDT 2018


morehouse added inline comments.


================
Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:173
+  int s = getSize((char *) func_ptr);
+  memcpy(mem, func_ptr, s);
+}
----------------
emmettneyman wrote:
> morehouse wrote:
> > Why do we need to copy the function somewhere else?  Looks very error-prone and unnecessary.  Also makes this patch larger than it needs to be.
> I'm copying the functions because otherwise, the generated machine code gets lost as soon as we exit that function's scope. So I'd have to run the functions inside `CreateJITFunction` if I don't copy it.
> 
> I thought about doing it this way: moving the code from `RunFuncsOnInputs` to the bottom of `CreateJITFunction` and then comparing the arrays after both calls to `CreateJITFunction` inside `HandleLLVM`. Do you think that would be cleaner?
Or just increase the scope of `EE`.


Repository:
  rC Clang

https://reviews.llvm.org/D50194





More information about the cfe-commits mailing list