Skip to content

Commit bceafb5

Browse files
committed
Omit binary value from xml if it is absent in the trace
There are instances when running with `--cprover-smt2` where the type of the expression is `bitvector_typet`, but the expression is not a `constant_exprt`. By removing the printing in this case we can avoid breaking the partial functionality available with the `--cprover-smt2` option.
1 parent e9961db commit bceafb5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/goto-programs/xml_goto_trace.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ xmlt full_lhs_value(const goto_trace_stept &step, const namespacet &ns)
3434
lhs_object.has_value() ? lhs_object->get_identifier() : irep_idt();
3535

3636
const exprt &value = step.full_lhs_value;
37-
if(value.is_not_nil())
38-
xml.data = from_expr(ns, identifier, value);
37+
if(value.is_nil())
38+
return xml;
3939

40-
if(const auto &type = type_try_dynamic_cast<bitvector_typet>(value.type()))
40+
xml.data = from_expr(ns, identifier, value);
41+
const auto &bv_type = type_try_dynamic_cast<bitvector_typet>(value.type());
42+
const auto &constant = expr_try_dynamic_cast<constant_exprt>(value);
43+
if(bv_type && constant)
4144
{
42-
const auto &constant =
43-
expr_try_dynamic_cast<constant_exprt>(value);
44-
const auto width = type->get_width();
45+
const auto width = bv_type->get_width();
4546
const auto binary_representation =
4647
integer2binary(bvrep2integer(constant->get_value(), width, false), width);
4748
xml.set_attribute("binary", binary_representation);

0 commit comments

Comments
 (0)