@@ -113,7 +113,8 @@ class goto_checkt
113
113
const exprt &access_ub);
114
114
conditionst address_check (
115
115
const exprt &address,
116
- const exprt &size);
116
+ const exprt &access_lb,
117
+ const exprt &access_ub);
117
118
void integer_overflow_check (const exprt &expr, const guardt &guard);
118
119
void conversion_check (const exprt &expr, const guardt &guard);
119
120
void float_overflow_check (const exprt &expr, const guardt &guard);
@@ -1098,7 +1099,8 @@ void goto_checkt::pointer_validity_check(
1098
1099
1099
1100
goto_checkt::conditionst goto_checkt::address_check (
1100
1101
const exprt &address,
1101
- const exprt &size)
1102
+ const exprt &access_lb,
1103
+ const exprt &access_ub)
1102
1104
{
1103
1105
if (!enable_pointer_check)
1104
1106
return {};
@@ -1130,7 +1132,6 @@ goto_checkt::conditionst goto_checkt::address_check(
1130
1132
{
1131
1133
typecast_exprt int_ptr (address, a.first .type ());
1132
1134
1133
- #if 0
1134
1135
exprt lb (int_ptr);
1135
1136
if (access_lb.is_not_nil ())
1136
1137
{
@@ -1155,7 +1156,6 @@ goto_checkt::conditionst goto_checkt::address_check(
1155
1156
ub, ID_le, plus_exprt (a.first , a.second ));
1156
1157
1157
1158
alloc_disjuncts.push_back (and_exprt (lb_check, ub_check));
1158
- #endif
1159
1159
}
1160
1160
1161
1161
const exprt allocs=disjunction (alloc_disjuncts);
@@ -1187,42 +1187,30 @@ goto_checkt::conditionst goto_checkt::address_check(
1187
1187
1188
1188
if (flags.is_unknown () || flags.is_dynamic_heap ())
1189
1189
{
1190
- #if 0
1191
1190
const or_exprt dynamic_bounds (
1192
1191
dynamic_object_lower_bound (address, ns, access_lb),
1193
1192
dynamic_object_upper_bound (address, dereference_type, ns, access_ub));
1194
1193
1195
- add_guarded_claim (
1194
+ conditions. push_back ( conditiont (
1196
1195
or_exprt (
1197
1196
allocs,
1198
1197
implies_exprt (
1199
1198
malloc_object (address, ns),
1200
1199
not_exprt (dynamic_bounds))),
1201
- "dereference failure: pointer outside dynamic object bounds",
1202
- "pointer dereference",
1203
- expr.find_source_location(),
1204
- expr,
1205
- guard);
1206
- #endif
1200
+ " pointer outside dynamic object bounds" ));
1207
1201
}
1208
1202
1209
1203
if (flags.is_unknown () ||
1210
1204
flags.is_dynamic_local () ||
1211
1205
flags.is_static_lifetime ())
1212
1206
{
1213
- #if 0
1214
1207
const or_exprt object_bounds (
1215
1208
object_lower_bound (address, ns, access_lb),
1216
1209
object_upper_bound (address, dereference_type, ns, access_ub));
1217
1210
1218
- add_guarded_claim (
1211
+ conditions. push_back ( conditiont (
1219
1212
or_exprt (allocs, dynamic_object (address), not_exprt (object_bounds)),
1220
- "dereference failure: pointer outside object bounds",
1221
- "pointer dereference",
1222
- expr.find_source_location(),
1223
- expr,
1224
- guard);
1225
- #endif
1213
+ " dereference failure: pointer outside object bounds" ));
1226
1214
}
1227
1215
1228
1216
return conditions;
@@ -1659,7 +1647,7 @@ void goto_checkt::rw_ok_check(exprt &expr)
1659
1647
DATA_INVARIANT (expr.operands ().size ()==2 ,
1660
1648
" r/w_ok must have two operands" );
1661
1649
1662
- const auto conditions=address_check (expr.op0 (), expr.op1 ());
1650
+ const auto conditions=address_check (expr.op0 (), nil_exprt (), expr.op1 ());
1663
1651
exprt::operandst conjuncts;
1664
1652
for (const auto &c : conditions)
1665
1653
conjuncts.push_back (c.assertion );
0 commit comments