@@ -123,7 +123,7 @@ void cover_goalst::constraint()
123
123
g_it=goals.begin ();
124
124
g_it!=goals.end ();
125
125
g_it++)
126
- if (!g_it->covered )
126
+ if (!g_it->covered && !g_it-> condition . is_false () )
127
127
bv.push_back (g_it->condition );
128
128
129
129
prop.lcnf (bv);
@@ -185,7 +185,7 @@ Function: bmct::cover_assertions
185
185
186
186
\*******************************************************************/
187
187
188
- void bmct::cover_assertions ()
188
+ void bmct::cover_assertions (const goto_functionst &goto_functions )
189
189
{
190
190
// with simplifier: need to freeze goal variables
191
191
// to prevent them from being eliminated
@@ -212,19 +212,27 @@ void bmct::cover_assertions()
212
212
equation.convert_decls (prop_conv);
213
213
equation.convert_assumptions (prop_conv);
214
214
215
- // collect goals in `goal_map'
216
- literalt assumption_literal=const_literal (true );
217
-
215
+ // collect _all_ goals in `goal_map'
218
216
typedef std::map<goto_programt::const_targett, bvt> goal_mapt;
219
217
goal_mapt goal_map;
218
+
219
+ forall_goto_functions (f_it, goto_functions)
220
+ forall_goto_program_instructions (i_it, f_it->second .body )
221
+ if (i_it->is_assert ())
222
+ goal_map[i_it]=bvt ();
223
+
224
+ // get the conditions for these goals from formula
225
+
226
+ literalt assumption_literal=const_literal (true );
220
227
221
228
for (symex_target_equationt::SSA_stepst::iterator
222
229
it=equation.SSA_steps .begin ();
223
230
it!=equation.SSA_steps .end ();
224
231
it++)
232
+ {
225
233
if (it->is_assert ())
226
234
{
227
- // we just want reachability, i.e., the guard,
235
+ // we just want reachability, i.e., the guard of the instruction ,
228
236
// not the assertion itself
229
237
literalt l=
230
238
prop_conv.prop .land (assumption_literal, it->guard_literal );
@@ -234,8 +242,9 @@ void bmct::cover_assertions()
234
242
else if (it->is_assume ())
235
243
assumption_literal=
236
244
prop_conv.prop .land (assumption_literal, it->cond_literal );
245
+ }
237
246
238
- // compute
247
+ // try to cover those
239
248
cover_goalst cover_goals (prop_conv);
240
249
cover_goals.set_message_handler (get_message_handler ());
241
250
cover_goals.set_verbosity (get_verbosity ());
@@ -245,6 +254,7 @@ void bmct::cover_assertions()
245
254
it!=goal_map.end ();
246
255
it++)
247
256
{
257
+ // the following is FALSE if the bv is empty
248
258
literalt condition=prop_conv.prop .lor (it->second );
249
259
cover_goals.add (condition, it->first ->location .as_string ());
250
260
}
0 commit comments