Skip to content

Commit 78570d9

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 2b42622 commit 78570d9

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/analyses/goto_check.cpp

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

10951106
void goto_checkt::pointer_validity_check(
10961107
const dereference_exprt &expr,
1108+
const exprt &src_expr,
10971109
const guardt &guard)
10981110
{
10991111
if(!enable_pointer_check)
@@ -1112,8 +1124,8 @@ void goto_checkt::pointer_validity_check(
11121124
c.assertion,
11131125
"dereference failure: " + c.description,
11141126
"pointer dereference",
1115-
expr.find_source_location(),
1116-
expr,
1127+
src_expr.find_source_location(),
1128+
src_expr,
11171129
guard);
11181130
}
11191131
}
@@ -1588,7 +1600,7 @@ bool goto_checkt::check_rec_member(const member_exprt &member, guardt &guard)
15881600

15891601
dereference_exprt new_deref{new_address_casted};
15901602
new_deref.add_source_location() = deref.source_location();
1591-
pointer_validity_check(new_deref, guard);
1603+
pointer_validity_check(new_deref, member, guard);
15921604

15931605
return true;
15941606
}
@@ -1690,7 +1702,7 @@ void goto_checkt::check_rec(const exprt &expr, guardt &guard)
16901702
pointer_rel_check(to_binary_relation_expr(expr), guard);
16911703
else if(expr.id()==ID_dereference)
16921704
{
1693-
pointer_validity_check(to_dereference_expr(expr), guard);
1705+
pointer_validity_check(to_dereference_expr(expr), expr, guard);
16941706
}
16951707
}
16961708

0 commit comments

Comments
 (0)