From c53efa786254711da3d0b0382efbdf176f7b3bde Mon Sep 17 00:00:00 2001 From: Garret Catron Date: Thu, 12 Sep 2019 10:54:47 -0700 Subject: [PATCH] Added check to llvm::expected address before overwriting it. --- lib/LLVMIRCodeGen/LLVMCompiledFunction.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/LLVMIRCodeGen/LLVMCompiledFunction.cpp b/lib/LLVMIRCodeGen/LLVMCompiledFunction.cpp index 59d42a3b38..b3684397d4 100644 --- a/lib/LLVMIRCodeGen/LLVMCompiledFunction.cpp +++ b/lib/LLVMIRCodeGen/LLVMCompiledFunction.cpp @@ -100,8 +100,10 @@ llvm::Error LLVMCompiledFunction::execute(ExecutionContext *context) { auto sym = JIT_->findSymbol("jitmain"); DCHECK(sym) << "Unable to JIT the code!"; - - address = sym.getAddress(); + // We know address is success since we just made it. Mark it as checked. + if (address) { + address = sym.getAddress(); + } } using JitFuncType = void (*)(uint8_t * constantWeightVars, uint8_t * mutableWeightVars,