Skip to content

Commit

Permalink
[fix] Halt when LLVM passes already proved unreachability
Browse files Browse the repository at this point in the history
  • Loading branch information
Columpio authored and misonijnik committed Oct 27, 2023
1 parent 0cb981d commit 0a80185
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions lib/Core/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6672,14 +6672,19 @@ void Executor::runFunctionAsMain(Function *f, int argc, char **argv,
} else {
/* Find all calls to function specified in .prp file
* and combine them to single target forest */
KFunction *kEntryFunction = kmodule->functionMap.at(f);
ref<TargetForest> forest = new TargetForest(kEntryFunction);
auto kfunction = kmodule->functionNameMap.at(FunctionCallReproduce);
KBlock *kCallBlock = kfunction->entryKBlock;
forest->add(ReproduceErrorTarget::create(
{ReachWithError::Reachable}, "",
ErrorLocation(kCallBlock->getFirstInstruction()), kCallBlock));
prepTargets.emplace(kEntryFunction, forest);
auto kfIt = kmodule->functionNameMap.find(FunctionCallReproduce);
if (kfIt == kmodule->functionNameMap.end()) {
klee_warning("%s was eliminated by LLVM passes, so it is unreachable",
FunctionCallReproduce.c_str());
} else {
auto kCallBlock = kfIt->second->entryKBlock;
KFunction *kEntryFunction = kmodule->functionMap.at(f);
ref<TargetForest> forest = new TargetForest(kEntryFunction);
forest->add(ReproduceErrorTarget::create(
{ReachWithError::Reachable}, "",
ErrorLocation(kCallBlock->getFirstInstruction()), kCallBlock));
prepTargets.emplace(kEntryFunction, forest);
}
}

if (prepTargets.empty()) {
Expand Down

0 comments on commit 0a80185

Please sign in to comment.