@@ -170,7 +170,18 @@ class goto_checkt
170
170
void undefined_shift_check (const shift_exprt &, const guardt &);
171
171
void pointer_rel_check (const binary_relation_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
+ // / 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
+
174
185
conditionst address_check (const exprt &address, const exprt &size);
175
186
void integer_overflow_check (const exprt &, const guardt &);
176
187
void conversion_check (const exprt &, const guardt &);
@@ -1094,6 +1105,7 @@ void goto_checkt::pointer_overflow_check(
1094
1105
1095
1106
void goto_checkt::pointer_validity_check (
1096
1107
const dereference_exprt &expr,
1108
+ const exprt &src_expr,
1097
1109
const guardt &guard)
1098
1110
{
1099
1111
if (!enable_pointer_check)
@@ -1112,8 +1124,8 @@ void goto_checkt::pointer_validity_check(
1112
1124
c.assertion ,
1113
1125
" dereference failure: " + c.description ,
1114
1126
" pointer dereference" ,
1115
- expr .find_source_location (),
1116
- expr ,
1127
+ src_expr .find_source_location (),
1128
+ src_expr ,
1117
1129
guard);
1118
1130
}
1119
1131
}
@@ -1588,7 +1600,7 @@ bool goto_checkt::check_rec_member(const member_exprt &member, guardt &guard)
1588
1600
1589
1601
dereference_exprt new_deref{new_address_casted};
1590
1602
new_deref.add_source_location () = deref.source_location ();
1591
- pointer_validity_check (new_deref, guard);
1603
+ pointer_validity_check (new_deref, member, guard);
1592
1604
1593
1605
return true ;
1594
1606
}
@@ -1690,7 +1702,7 @@ void goto_checkt::check_rec(const exprt &expr, guardt &guard)
1690
1702
pointer_rel_check (to_binary_relation_expr (expr), guard);
1691
1703
else if (expr.id ()==ID_dereference)
1692
1704
{
1693
- pointer_validity_check (to_dereference_expr (expr), guard);
1705
+ pointer_validity_check (to_dereference_expr (expr), expr, guard);
1694
1706
}
1695
1707
}
1696
1708
0 commit comments