Skip to content

Commit c3e5f4e

Browse files
Add properties_result_from_symex_target_equation
Updates the property infos with properties created by goto-symex and sets the status of already determined properies.
1 parent 661a39c commit c3e5f4e

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

src/goto-checker/bmc_util.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,53 @@ void slice(
225225
<< " remaining after simplification" << messaget::eom;
226226
}
227227

228+
std::vector<irep_idt> update_properties_status_from_symex_target_equation(
229+
propertiest &properties,
230+
const symex_target_equationt &equation)
231+
{
232+
std::vector<irep_idt> updated_properties;
233+
234+
for(const auto &step : equation.SSA_steps)
235+
{
236+
if(!step.is_assert())
237+
continue;
238+
239+
irep_idt property_id = step.get_property_id();
240+
241+
if(property_id.empty())
242+
continue;
243+
244+
// Don't set false properties; we wouldn't have traces for them.
245+
const auto status = step.cond_expr.is_true() ? property_statust::PASS
246+
: property_statust::UNKNOWN;
247+
auto emplace_result = properties.emplace(
248+
property_id, property_infot{step.source.pc, step.comment, status});
249+
250+
if(emplace_result.second)
251+
{
252+
updated_properties.push_back(property_id);
253+
}
254+
else
255+
{
256+
property_infot &property_info = emplace_result.first->second;
257+
property_statust old_status = property_info.status;
258+
property_info.status |= status;
259+
260+
if(property_info.status != old_status)
261+
updated_properties.push_back(property_id);
262+
}
263+
}
264+
265+
for(auto &property_pair : properties)
266+
{
267+
if(property_pair.second.status == property_statust::NOT_CHECKED)
268+
{
269+
// This could be a NOT_CHECKED, NOT_REACHABLE or PASS,
270+
// but the equation doesn't give us precise information.
271+
property_pair.second.status = property_statust::PASS;
272+
updated_properties.push_back(property_pair.first);
273+
}
274+
}
275+
276+
return updated_properties;
277+
}

src/goto-checker/bmc_util.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Author: Daniel Kroening, Peter Schrammel
1616

1717
#include <goto-programs/safety_checker.h>
1818

19+
#include "properties.h"
20+
1921
class goto_tracet;
2022
class memory_model_baset;
2123
class message_handlert;
@@ -67,6 +69,13 @@ void slice(
6769
const optionst &,
6870
ui_message_handlert &);
6971

72+
/// Sets property status to PASS for properties whose
73+
/// conditions are constant true.
74+
/// \return IDs of updated properties
75+
std::vector<irep_idt> update_properties_status_from_symex_target_equation(
76+
propertiest &properties,
77+
const symex_target_equationt &equation);
78+
7079
// clang-format off
7180
#define OPT_BMC \
7281
"(program-only)" \

0 commit comments

Comments
 (0)