Skip to content

Commit 52c6fcb

Browse files
committed
Only add assumption scope if not empty
The GOTO trace may contain instructions from the global scope (e.g. assigning a value to a global variable). In such case, the scope should be global, i.e. no assumption.scope as per the witness specification. Signed-off-by: František Nečas <[email protected]>
1 parent 75b1e03 commit 52c6fcb

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/goto-programs/graphml_witness.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -476,15 +476,18 @@ void graphml_witnesst::operator()(const goto_tracet &goto_trace)
476476
code_assignt assign{it->full_lhs, it->full_lhs_value};
477477
val.data = convert_assign_rec(lhs_id, assign);
478478

479-
xmlt &val_s = edge.new_element("data");
480-
val_s.set_attribute("key", "assumption.scope");
481-
irep_idt function_id = it->function_id;
482-
const symbolt *symbol_ptr = nullptr;
483-
if(!ns.lookup(lhs_id, symbol_ptr) && symbol_ptr->is_parameter)
479+
if(!it->function_id.empty())
484480
{
485-
function_id = lhs_id.substr(0, lhs_id.find("::"));
481+
xmlt &val_s = edge.new_element("data");
482+
val_s.set_attribute("key", "assumption.scope");
483+
irep_idt function_id = it->function_id;
484+
const symbolt *symbol_ptr = nullptr;
485+
if(!ns.lookup(lhs_id, symbol_ptr) && symbol_ptr->is_parameter)
486+
{
487+
function_id = lhs_id.substr(0, lhs_id.find("::"));
488+
}
489+
val_s.data = id2string(function_id);
486490
}
487-
val_s.data = id2string(function_id);
488491

489492
if(has_prefix(val.data, "\\result ="))
490493
{

0 commit comments

Comments
 (0)