@@ -1399,25 +1399,10 @@ void goto_checkt::bounds_check(
1399
1399
1400
1400
binary_relation_exprt inequality (effective_offset, ID_lt, size_casted);
1401
1401
1402
- exprt::operandst alloc_disjuncts;
1403
- for (const auto &a : allocations)
1404
- {
1405
- typecast_exprt int_ptr{pointer, a.first .type ()};
1406
-
1407
- binary_relation_exprt lower_bound_check{a.first , ID_le, int_ptr};
1408
-
1409
- plus_exprt upper_bound{
1410
- int_ptr,
1411
- typecast_exprt::conditional_cast (ode.offset (), int_ptr.type ())};
1412
-
1413
- binary_relation_exprt upper_bound_check{
1414
- std::move (upper_bound), ID_lt, plus_exprt{a.first , a.second }};
1415
-
1416
- alloc_disjuncts.push_back (
1417
- and_exprt{std::move (lower_bound_check), std::move (upper_bound_check)});
1418
- }
1419
-
1420
- exprt in_bounds_of_some_explicit_allocation = disjunction (alloc_disjuncts);
1402
+ exprt in_bounds_of_some_explicit_allocation =
1403
+ is_in_bounds_of_some_explicit_allocation (
1404
+ pointer,
1405
+ plus_exprt{ode.offset (), from_integer (1 , ode.offset ().type ())});
1421
1406
1422
1407
or_exprt precond (
1423
1408
std::move (in_bounds_of_some_explicit_allocation),
@@ -2299,11 +2284,14 @@ exprt goto_checkt::is_in_bounds_of_some_explicit_allocation(
2299
2284
2300
2285
binary_relation_exprt lb_check (a.first , ID_le, int_ptr);
2301
2286
2302
- plus_exprt ub{int_ptr, size};
2287
+ plus_exprt upper_bound{
2288
+ int_ptr, typecast_exprt::conditional_cast (size, int_ptr.type ())};
2303
2289
2304
- binary_relation_exprt ub_check (ub, ID_le, plus_exprt (a.first , a.second ));
2290
+ binary_relation_exprt ub_check{
2291
+ std::move (upper_bound), ID_le, plus_exprt{a.first , a.second }};
2305
2292
2306
- alloc_disjuncts.push_back (and_exprt (lb_check, ub_check));
2293
+ alloc_disjuncts.push_back (
2294
+ and_exprt{std::move (lb_check), std::move (ub_check)});
2307
2295
}
2308
2296
return disjunction (alloc_disjuncts);
2309
2297
}
0 commit comments