Skip to content

Commit a9d96f6

Browse files
author
Owen Jones
committed
Remove SSA ids from goto trace
When building the goto trace we remove the SSA ids from most variable names, but they were still in address-of expressions in the right hand sides of assignments.
1 parent 671193c commit a9d96f6

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

regression/cbmc/pointer-function-parameters-2/test.desc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ main.c
55
^\*\* Used 4 iterations$
66
^Test suite:$
77
^a=\(\(signed int \*\*\)NULL\), tmp\$1=[^,]*, tmp\$2=[^,]*$
8-
^a=&tmp\$1!0, tmp\$1=\(\(signed int \*\)NULL\), tmp\$2=[^,]*$
9-
^a=&tmp\$1!0, tmp\$1=&tmp\$2!0, tmp\$2=([012356789][0-9]*|4[0-9]+)$
10-
^a=&tmp\$1!0, tmp\$1=&tmp\$2!0, tmp\$2=4$
8+
^a=&tmp\$1, tmp\$1=\(\(signed int \*\)NULL\), tmp\$2=[^,]*$
9+
^a=&tmp\$1, tmp\$1=&tmp\$2, tmp\$2=([012356789][0-9]*|4[0-9]+)$
10+
^a=&tmp\$1, tmp\$1=&tmp\$2, tmp\$2=4$
1111
--
1212
^warning: ignoring

regression/cbmc/pointer-function-parameters/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ main.c
55
^\*\* Used 3 iterations$
66
^Test suite:$
77
^a=\(\(signed int \*\)NULL\), tmp\$1=[^,]*$
8-
^a=&tmp\$1!0, tmp\$1=4$
9-
^a=&tmp\$1!0, tmp\$1=([012356789][0-9]*|4[0-9]+)$
8+
^a=&tmp\$1, tmp\$1=4$
9+
^a=&tmp\$1, tmp\$1=([012356789][0-9]*|4[0-9]+)$
1010
--
1111
^warning: ignoring

src/goto-symex/build_goto_trace.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,17 @@ void build_goto_trace(
364364
goto_trace_step.io_args.push_back(j);
365365
else
366366
{
367-
exprt tmp=prop_conv.get(j);
368-
goto_trace_step.io_args.push_back(tmp);
367+
// we only expect constants here
368+
exprt expr=to_constant_expr(prop_conv.get(j));
369+
if(expr.has_operands() && expr.op0().id()==ID_address_of)
370+
{
371+
exprt *op=&(to_address_of_expr(expr.op0()).object());
372+
while(op->id()==ID_member || op->id()==ID_index)
373+
op=&(op->op0());
374+
*op=to_ssa_expr(*op).get_original_expr();
375+
}
376+
// use expr in the output
377+
goto_trace_step.io_args.push_back(expr);
369378
}
370379
}
371380

0 commit comments

Comments
 (0)