Skip to content

Commit 30b361a

Browse files
authored
Merge pull request #3817 from peterschrammel/symex-equation-property-id
Get property ID for SSA step assert
2 parents 42c6f44 + 9c48c53 commit 30b361a

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

src/cbmc/all_properties.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,16 @@ safety_checkert::resultt bmc_all_propertiest::operator()()
7878
{
7979
if(it->is_assert())
8080
{
81-
irep_idt property_id;
81+
irep_idt property_id = it->get_property_id();
8282

83-
if(it->source.pc->is_assert())
84-
property_id=it->source.pc->source_location.get_property_id();
85-
else if(it->source.pc->is_goto())
83+
if(property_id.empty())
84+
continue;
85+
86+
if(it->source.pc->is_goto())
8687
{
87-
// this is likely an unwinding assertion
88-
property_id=id2string(
89-
it->source.pc->source_location.get_function())+".unwind."+
90-
std::to_string(it->source.pc->loop_number);
91-
goal_map[property_id].description=it->comment;
88+
// goto may yield an unwinding assertion
89+
goal_map[property_id].description = it->comment;
9290
}
93-
else
94-
continue;
9591

9692
goal_map[property_id].instances.push_back(it);
9793
}

src/goto-symex/symex_target_equation.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,3 +1007,27 @@ void symex_target_equationt::SSA_stept::validate(
10071007
break;
10081008
}
10091009
}
1010+
1011+
irep_idt symex_target_equationt::SSA_stept::get_property_id() const
1012+
{
1013+
PRECONDITION(is_assert());
1014+
1015+
irep_idt property_id;
1016+
1017+
if(source.pc->is_assert())
1018+
{
1019+
property_id = source.pc->source_location.get_property_id();
1020+
}
1021+
else if(source.pc->is_goto())
1022+
{
1023+
// this is likely an unwinding assertion
1024+
property_id = id2string(source.pc->source_location.get_function()) +
1025+
".unwind." + std::to_string(source.pc->loop_number);
1026+
}
1027+
else
1028+
{
1029+
// return empty
1030+
}
1031+
1032+
return property_id;
1033+
}

src/goto-symex/symex_target_equation.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ class symex_target_equationt:public symex_targett
279279
// NOLINTNEXTLINE(whitespace/line_length)
280280
bool is_atomic_end() const { return type==goto_trace_stept::typet::ATOMIC_END; }
281281

282+
// return the property ID if this is an assertion step
283+
irep_idt get_property_id() const;
284+
282285
// we may choose to hide
283286
bool hidden=false;
284287

0 commit comments

Comments
 (0)