@@ -1399,25 +1399,10 @@ void goto_checkt::bounds_check(
13991399
14001400 binary_relation_exprt inequality (effective_offset, ID_lt, size_casted);
14011401
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 ())});
14211406
14221407 or_exprt precond (
14231408 std::move (in_bounds_of_some_explicit_allocation),
@@ -2299,11 +2284,14 @@ exprt goto_checkt::is_in_bounds_of_some_explicit_allocation(
22992284
23002285 binary_relation_exprt lb_check (a.first , ID_le, int_ptr);
23012286
2302- plus_exprt ub{int_ptr, size};
2287+ plus_exprt upper_bound{
2288+ int_ptr, typecast_exprt::conditional_cast (size, int_ptr.type ())};
23032289
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 }};
23052292
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)});
23072295 }
23082296 return disjunction (alloc_disjuncts);
23092297}
0 commit comments