Skip to content

Commit ab1c30b

Browse files
author
Daniel Kroening
committed
beautify property description for p->m
The new description is closer to the original program and thus less confusing.
1 parent 701649e commit ab1c30b

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/analyses/goto_check.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,17 @@ class goto_checkt
170170
void undefined_shift_check(const shift_exprt &, const guardt &);
171171
void pointer_rel_check(const exprt &, const guardt &);
172172
void pointer_overflow_check(const exprt &, const guardt &);
173-
void pointer_validity_check(const dereference_exprt &, const guardt &);
173+
174+
/// Generates VCCs for the validity of the given dereferencing operation.
175+
/// \param expr the expression to be checked
176+
/// \param src_expr The expression as found in the program,
177+
/// prior to any rewriting
178+
/// \param guard the condition under which the operation happens
179+
void pointer_validity_check(
180+
const dereference_exprt &expr,
181+
const exprt &src_expr,
182+
const guardt &guard);
183+
174184
conditionst address_check(const exprt &address, const exprt &size);
175185
void integer_overflow_check(const exprt &, const guardt &);
176186
void conversion_check(const exprt &, const guardt &);
@@ -1112,6 +1122,7 @@ void goto_checkt::pointer_overflow_check(
11121122

11131123
void goto_checkt::pointer_validity_check(
11141124
const dereference_exprt &expr,
1125+
const exprt &src_expr,
11151126
const guardt &guard)
11161127
{
11171128
if(!enable_pointer_check)
@@ -1130,8 +1141,8 @@ void goto_checkt::pointer_validity_check(
11301141
c.assertion,
11311142
"dereference failure: " + c.description,
11321143
"pointer dereference",
1133-
expr.find_source_location(),
1134-
expr,
1144+
src_expr.find_source_location(),
1145+
src_expr,
11351146
guard);
11361147
}
11371148
}
@@ -1606,7 +1617,7 @@ bool goto_checkt::check_rec_member(const member_exprt &member, guardt &guard)
16061617

16071618
dereference_exprt new_deref{new_address_casted};
16081619
new_deref.add_source_location() = deref.source_location();
1609-
pointer_validity_check(new_deref, guard);
1620+
pointer_validity_check(new_deref, member, guard);
16101621

16111622
return true;
16121623
}
@@ -1708,7 +1719,7 @@ void goto_checkt::check_rec(const exprt &expr, guardt &guard)
17081719
pointer_rel_check(expr, guard);
17091720
else if(expr.id()==ID_dereference)
17101721
{
1711-
pointer_validity_check(to_dereference_expr(expr), guard);
1722+
pointer_validity_check(to_dereference_expr(expr), expr, guard);
17121723
}
17131724
}
17141725

0 commit comments

Comments
 (0)