Skip to content

Commit ad93441

Browse files
committed
goto-symex: initialisation of pointers is no longer necessary
goto-symex now treats empty value sets as dereferences to all current objects. Therefore, there is no need to initialise the value set for pointer-typed objects upon declaration.
1 parent 0cfa0c9 commit ad93441

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

regression/cbmc/nondet-pointer/nondet-pointer1.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ int main()
55
int x = 123;
66
int *p = &x;
77
int *q = nondet_pointer();
8+
int *r;
89

910
if(p == q)
1011
__CPROVER_assert(*q == 123, "value of *q");
1112

13+
if(p == r)
14+
__CPROVER_assert(*r == 123, "value of *q");
15+
1216
return 0;
1317
}

src/goto-symex/goto_symex_state.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -820,21 +820,6 @@ ssa_exprt goto_symex_statet::declare(ssa_exprt ssa, const namespacet &ns)
820820
rename(ssa.type(), l1_identifier, ns);
821821
ssa.update_type();
822822

823-
// in case of pointers, put something into the value set
824-
if(ssa.type().id() == ID_pointer)
825-
{
826-
exprt rhs;
827-
if(
828-
auto failed =
829-
get_failed_symbol(to_symbol_expr(ssa.get_original_expr()), ns))
830-
rhs = address_of_exprt(*failed, to_pointer_type(ssa.type()));
831-
else
832-
rhs = exprt(ID_invalid);
833-
834-
exprt l1_rhs = rename<L1>(std::move(rhs), ns).get();
835-
value_set.assign(ssa, l1_rhs, ns, true, false);
836-
}
837-
838823
// L2 renaming
839824
const exprt fields = field_sensitivity.get_fields(ns, *this, ssa);
840825
for(const auto &l1_symbol : find_symbols(fields))

0 commit comments

Comments
 (0)