@@ -170,7 +170,17 @@ class goto_checkt
170
170
void undefined_shift_check (const shift_exprt &, const guardt &);
171
171
void pointer_rel_check (const exprt &, const guardt &);
172
172
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
+
174
184
conditionst address_check (const exprt &address, const exprt &size);
175
185
void integer_overflow_check (const exprt &, const guardt &);
176
186
void conversion_check (const exprt &, const guardt &);
@@ -1112,6 +1122,7 @@ void goto_checkt::pointer_overflow_check(
1112
1122
1113
1123
void goto_checkt::pointer_validity_check (
1114
1124
const dereference_exprt &expr,
1125
+ const exprt &src_expr,
1115
1126
const guardt &guard)
1116
1127
{
1117
1128
if (!enable_pointer_check)
@@ -1130,8 +1141,8 @@ void goto_checkt::pointer_validity_check(
1130
1141
c.assertion ,
1131
1142
" dereference failure: " + c.description ,
1132
1143
" pointer dereference" ,
1133
- expr .find_source_location (),
1134
- expr ,
1144
+ src_expr .find_source_location (),
1145
+ src_expr ,
1135
1146
guard);
1136
1147
}
1137
1148
}
@@ -1606,7 +1617,7 @@ bool goto_checkt::check_rec_member(const member_exprt &member, guardt &guard)
1606
1617
1607
1618
dereference_exprt new_deref{new_address_casted};
1608
1619
new_deref.add_source_location () = deref.source_location ();
1609
- pointer_validity_check (new_deref, guard);
1620
+ pointer_validity_check (new_deref, member, guard);
1610
1621
1611
1622
return true ;
1612
1623
}
@@ -1708,7 +1719,7 @@ void goto_checkt::check_rec(const exprt &expr, guardt &guard)
1708
1719
pointer_rel_check (expr, guard);
1709
1720
else if (expr.id ()==ID_dereference)
1710
1721
{
1711
- pointer_validity_check (to_dereference_expr (expr), guard);
1722
+ pointer_validity_check (to_dereference_expr (expr), expr, guard);
1712
1723
}
1713
1724
}
1714
1725
0 commit comments