@@ -123,7 +123,7 @@ void cover_goalst::constraint()
123123 g_it=goals.begin ();
124124 g_it!=goals.end ();
125125 g_it++)
126- if (!g_it->covered )
126+ if (!g_it->covered && !g_it-> condition . is_false () )
127127 bv.push_back (g_it->condition );
128128
129129 prop.lcnf (bv);
@@ -185,7 +185,7 @@ Function: bmct::cover_assertions
185185
186186\*******************************************************************/
187187
188- void bmct::cover_assertions ()
188+ void bmct::cover_assertions (const goto_functionst &goto_functions )
189189{
190190 // with simplifier: need to freeze goal variables
191191 // to prevent them from being eliminated
@@ -212,19 +212,27 @@ void bmct::cover_assertions()
212212 equation.convert_decls (prop_conv);
213213 equation.convert_assumptions (prop_conv);
214214
215- // collect goals in `goal_map'
216- literalt assumption_literal=const_literal (true );
217-
215+ // collect _all_ goals in `goal_map'
218216 typedef std::map<goto_programt::const_targett, bvt> goal_mapt;
219217 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 );
220227
221228 for (symex_target_equationt::SSA_stepst::iterator
222229 it=equation.SSA_steps .begin ();
223230 it!=equation.SSA_steps .end ();
224231 it++)
232+ {
225233 if (it->is_assert ())
226234 {
227- // we just want reachability, i.e., the guard,
235+ // we just want reachability, i.e., the guard of the instruction ,
228236 // not the assertion itself
229237 literalt l=
230238 prop_conv.prop .land (assumption_literal, it->guard_literal );
@@ -234,8 +242,9 @@ void bmct::cover_assertions()
234242 else if (it->is_assume ())
235243 assumption_literal=
236244 prop_conv.prop .land (assumption_literal, it->cond_literal );
245+ }
237246
238- // compute
247+ // try to cover those
239248 cover_goalst cover_goals (prop_conv);
240249 cover_goals.set_message_handler (get_message_handler ());
241250 cover_goals.set_verbosity (get_verbosity ());
@@ -245,6 +254,7 @@ void bmct::cover_assertions()
245254 it!=goal_map.end ();
246255 it++)
247256 {
257+ // the following is FALSE if the bv is empty
248258 literalt condition=prop_conv.prop .lor (it->second );
249259 cover_goals.add (condition, it->first ->location .as_string ());
250260 }
0 commit comments