Skip to content

Commit db496e8

Browse files
committed
BDDs require a namespace - pass one to guardt's or operator
1 parent 0fc3854 commit db496e8

File tree

5 files changed

+16
-19
lines changed

5 files changed

+16
-19
lines changed

src/goto-symex/goto_symex_state.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ bool goto_symex_statet::l2_thread_read_encoding(
575575
// that implies the current one
576576
return false;
577577

578-
write_guard|=*it;
578+
write_guard.logical_or(*it, ns);
579579
}
580580
}
581581

@@ -600,7 +600,7 @@ bool goto_symex_statet::l2_thread_read_encoding(
600600
// that implies the current one
601601
return false;
602602

603-
read_guard|=*it;
603+
read_guard.logical_or(*it, ns);
604604
}
605605

606606
exprt cond=read_guard.as_expr();

src/goto-symex/symex_atomic_section.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void goto_symext::symex_atomic_end(statet &state)
5757
it=++(r_it->second.second.begin());
5858
it!=r_it->second.second.end();
5959
++it)
60-
read_guard|=*it;
60+
read_guard.logical_or(*it, ns);
6161
exprt read_guard_expr=read_guard.as_expr();
6262
do_simplify(read_guard_expr);
6363

@@ -83,7 +83,7 @@ void goto_symext::symex_atomic_end(statet &state)
8383
it=++(w_it->second.begin());
8484
it!=w_it->second.end();
8585
++it)
86-
write_guard|=*it;
86+
write_guard.logical_or(*it, ns);
8787
exprt write_guard_expr=write_guard.as_expr();
8888
do_simplify(write_guard_expr);
8989

src/goto-symex/symex_goto.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,19 @@ void goto_symext::merge_goto(
235235
const statet::goto_statet &goto_state,
236236
statet &state)
237237
{
238+
statet::goto_statet &goto_state=*list_it;
239+
238240
// check atomic section
239241
if(state.atomic_section_id!=goto_state.atomic_section_id)
240-
throw "atomic sections differ across branches";
242+
throw "Atomic sections differ across branches";
241243

242244
// do SSA phi functions
243245
phi_function(goto_state, state);
244246

245247
merge_value_sets(goto_state, state);
246248

247249
// adjust guard
248-
state.guard|=goto_state.guard;
250+
state.guard.logical_or(goto_state.guard, ns);
249251

250252
// adjust depth
251253
state.depth=std::min(state.depth, goto_state.depth);

src/util/guard.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,12 @@ guardt &operator -= (guardt &g1, const guardt &g2)
123123
return g1;
124124
}
125125

126-
guardt &operator |= (guardt &g1, const guardt &g2)
126+
guardt& guardt::logical_or(const guardt &g2, const namespacet &ns)
127127
{
128-
if(g2.is_false() || g1.is_true())
129-
return g1;
130-
if(g1.is_false() || g2.is_true())
131-
{
132-
g1=g2;
133-
return g1;
134-
}
128+
guardt &g1=*this;
129+
130+
if(g2.is_false() || g1.is_true()) return g1;
131+
if(g1.is_false() || g2.is_true()) { g1=g2; return g1; }
135132

136133
if(g1.id()!=ID_and || g2.id()!=ID_and)
137134
{
@@ -143,8 +140,6 @@ guardt &operator |= (guardt &g1, const guardt &g2)
143140
else
144141
g1=or_exprt(g1, g2);
145142

146-
symbol_tablet symbol_table;
147-
namespacet ns(symbol_table);
148143
bdd_exprt t(ns);
149144
t.from_expr(g1);
150145
g1=t.as_expr();
@@ -207,8 +202,6 @@ guardt &operator |= (guardt &g1, const guardt &g2)
207202
{
208203
g1.add(or_exprt(and_expr1, and_expr2));
209204

210-
symbol_tablet symbol_table;
211-
namespacet ns(symbol_table);
212205
bdd_exprt t(ns);
213206
t.from_expr(g1);
214207
g1=t.as_expr();

src/util/guard.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Author: Daniel Kroening, [email protected]
1616

1717
#include "expr.h"
1818

19+
class namespacet;
20+
1921
class guardt:public exprt
2022
{
2123
public:
@@ -61,7 +63,7 @@ class guardt:public exprt
6163
#endif
6264

6365
friend guardt &operator -= (guardt &g1, const guardt &g2);
64-
friend guardt &operator |= (guardt &g1, const guardt &g2);
66+
guardt& logical_or(const guardt &g2, const namespacet &ns);
6567

6668
#if 0
6769
void swap(guardt &g)

0 commit comments

Comments
 (0)