Skip to content

Commit 652ea09

Browse files
author
Daniel Kroening
authored
Merge pull request #1205 from tautschnig/sign-compare-fix
Avoid spurious signed/unsigned comparison warnings
2 parents bb9cef3 + a3578c0 commit 652ea09

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

src/symex/path_search.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,15 @@ bool path_searcht::drop_state(const statet &state)
281281
}
282282

283283
// depth limit
284-
if(depth_limit>=0 && state.get_depth()>depth_limit)
284+
if(state.get_depth()>=depth_limit)
285285
return true;
286286

287287
// context bound
288-
if(context_bound>=0 && state.get_no_thread_interleavings()>context_bound)
288+
if(state.get_no_thread_interleavings()>=context_bound)
289289
return true;
290290

291291
// branch bound
292-
if(branch_bound>=0 && state.get_no_branches()>branch_bound)
292+
if(state.get_no_branches()>=branch_bound)
293293
return true;
294294

295295
// unwinding limit -- loops
@@ -298,7 +298,7 @@ bool path_searcht::drop_state(const statet &state)
298298
bool stop=false;
299299

300300
for(const auto &loop_info : state.unwinding_map)
301-
if(loop_info.second>unwind_limit)
301+
if(loop_info.second>=unwind_limit)
302302
{
303303
stop=true;
304304
break;
@@ -324,7 +324,7 @@ bool path_searcht::drop_state(const statet &state)
324324
bool stop=false;
325325

326326
for(const auto &rec_info : state.recursion_map)
327-
if(rec_info.second>unwind_limit)
327+
if(rec_info.second>=unwind_limit)
328328
{
329329
stop=true;
330330
break;

src/symex/path_search.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,20 @@ Author: Daniel Kroening, [email protected]
1919

2020
#include <path-symex/path_symex_state.h>
2121

22+
#include <limits>
23+
2224
class path_searcht:public safety_checkert
2325
{
2426
public:
2527
explicit path_searcht(const namespacet &_ns):
2628
safety_checkert(_ns),
2729
show_vcc(false),
2830
eager_infeasibility(false),
29-
depth_limit(-1), // no limit
30-
context_bound(-1),
31-
branch_bound(-1),
32-
unwind_limit(-1),
33-
time_limit(-1),
31+
depth_limit(std::numeric_limits<unsigned>::max()),
32+
context_bound(std::numeric_limits<unsigned>::max()),
33+
branch_bound(std::numeric_limits<unsigned>::max()),
34+
unwind_limit(std::numeric_limits<unsigned>::max()),
35+
time_limit(std::numeric_limits<unsigned>::max()),
3436
search_heuristic(search_heuristict::DFS)
3537
{
3638
}
@@ -132,11 +134,11 @@ class path_searcht:public safety_checkert
132134
void initialize_property_map(
133135
const goto_functionst &goto_functions);
134136

135-
int depth_limit;
136-
int context_bound;
137-
int branch_bound;
138-
int unwind_limit;
139-
int time_limit;
137+
unsigned depth_limit;
138+
unsigned context_bound;
139+
unsigned branch_bound;
140+
unsigned unwind_limit;
141+
unsigned time_limit;
140142

141143
enum class search_heuristict { DFS, BFS, LOCS } search_heuristic;
142144

0 commit comments

Comments
 (0)