Skip to content

Commit

Permalink
[fix] Fix isStuck
Browse files Browse the repository at this point in the history
  • Loading branch information
misonijnik committed Nov 3, 2023
1 parent 01ddb65 commit 9f054a9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Core/ExecutionState.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,9 @@ class ExecutionState {
}

inline bool isStuck(unsigned long long bound) const {
if (depth == 1)
if (depth == 0)
return false;
return isCycled(bound) && depth > klee::util::ulog2(bound);
return isCycled(bound) && klee::util::ulog2(depth) > bound;
}

bool isCoveredNew() const {
Expand Down
2 changes: 1 addition & 1 deletion lib/Core/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4415,7 +4415,7 @@ void Executor::executeStep(ExecutionState &state) {
if (targetManager->isTargeted(state) && state.targets().empty()) {
terminateStateEarlyAlgorithm(state, "State missed all it's targets.",
StateTerminationType::MissedAllTargets);
} else if (state.isStuck(MaxCycles)) {
} else if (state.isCycled(MaxCycles)) {
terminateStateEarly(state, "max-cycles exceeded.",
StateTerminationType::MaxCycles);
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/Core/TargetManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void TargetManager::updateReached(ExecutionState &state) {

void TargetManager::updateTargets(ExecutionState &state) {
if (guidance == Interpreter::GuidanceKind::CoverageGuidance) {
if (targets(state).empty() && state.isCycled(MaxCyclesBeforeStuck)) {
if (targets(state).empty() && state.isStuck(MaxCyclesBeforeStuck)) {
state.setTargeted(true);
}
if (isTargeted(state) && targets(state).empty()) {
Expand Down

0 comments on commit 9f054a9

Please sign in to comment.