Skip to content

Commit

Permalink
Assert doesn't get compiled in Release mode (#131)
Browse files Browse the repository at this point in the history
This creates a scenario where the Expected<T> doesn't get checked and
the execution crashes, even if the engine was created correctly.
  • Loading branch information
rengolin authored Jul 4, 2024
1 parent 71d28d7 commit 0b53034
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,12 @@ class MLIREvaluate {
// in `create` independently
engineOptions.llvmModuleBuilder = lowerToLLVMIR;
auto maybeEngine = mlir::ExecutionEngine::create(module.get(), engineOptions);
assert(maybeEngine && "failed to construct an execution engine");
engine = std::move(maybeEngine.get());
if (maybeEngine) {
engine = std::move(maybeEngine.get());
} else {
llvm::errs() << "failed to construct an execution engine\n";
abort();
}
}

bool invoke_packed(std::vector<void*>& args) {
Expand Down

0 comments on commit 0b53034

Please sign in to comment.