@@ -228,7 +228,6 @@ class goto_check_ct
228228 void conversion_check (const exprt &, const guardt &);
229229 void float_overflow_check (const exprt &, const guardt &);
230230 void nan_check (const exprt &, const guardt &);
231- optionalt<exprt> expand_pointer_checks (exprt);
232231
233232 std::string array_name (const exprt &);
234233
@@ -1444,6 +1443,8 @@ void goto_check_ct::pointer_primitive_check(
14441443 const exprt pointer =
14451444 (expr.id () == ID_r_ok || expr.id () == ID_w_ok || expr.id () == ID_rw_ok)
14461445 ? to_r_or_w_ok_expr (expr).pointer ()
1446+ : can_cast_expr<prophecy_r_or_w_ok_exprt>(expr)
1447+ ? to_prophecy_r_or_w_ok_expr (expr).pointer ()
14471448 : to_unary_expr (expr).op ();
14481449
14491450 CHECK_RETURN (pointer.type ().id () == ID_pointer);
@@ -1484,6 +1485,7 @@ bool goto_check_ct::requires_pointer_primitive_check(const exprt &expr)
14841485 // will equally be non-deterministic.
14851486 return can_cast_expr<object_size_exprt>(expr) || expr.id () == ID_r_ok ||
14861487 expr.id () == ID_w_ok || expr.id () == ID_rw_ok ||
1488+ can_cast_expr<prophecy_r_or_w_ok_exprt>(expr) ||
14871489 expr.id () == ID_is_dynamic_object;
14881490}
14891491
@@ -1992,62 +1994,6 @@ void goto_check_ct::check(const exprt &expr)
19921994 check_rec (expr, identity);
19931995}
19941996
1995- // / expand the r_ok, w_ok, rw_ok, pointer_in_range predicates
1996- optionalt<exprt> goto_check_ct::expand_pointer_checks (exprt expr)
1997- {
1998- bool modified = false ;
1999-
2000- for (auto &op : expr.operands ())
2001- {
2002- auto op_result = expand_pointer_checks (op);
2003- if (op_result.has_value ())
2004- {
2005- op = *op_result;
2006- modified = true ;
2007- }
2008- }
2009-
2010- if (expr.id () == ID_r_ok || expr.id () == ID_w_ok || expr.id () == ID_rw_ok)
2011- {
2012- // these get an address as first argument and a size as second
2013- DATA_INVARIANT (
2014- expr.operands ().size () == 2 , " r/w_ok must have two operands" );
2015-
2016- const auto conditions = get_pointer_dereferenceable_conditions (
2017- to_r_or_w_ok_expr (expr).pointer (), to_r_or_w_ok_expr (expr).size ());
2018-
2019- exprt::operandst conjuncts;
2020-
2021- for (const auto &c : conditions)
2022- conjuncts.push_back (c.assertion );
2023-
2024- exprt c = conjunction (conjuncts);
2025- if (enable_simplify)
2026- simplify (c, ns);
2027- return c;
2028- }
2029- else if (expr.id () == ID_pointer_in_range)
2030- {
2031- const auto &pointer_in_range_expr = to_pointer_in_range_expr (expr);
2032-
2033- auto expanded = pointer_in_range_expr.lower ();
2034-
2035- // rec. call
2036- auto expanded_rec_opt = expand_pointer_checks (expanded);
2037- if (expanded_rec_opt.has_value ())
2038- expanded = *expanded_rec_opt;
2039-
2040- if (enable_simplify)
2041- simplify (expanded, ns);
2042-
2043- return expanded;
2044- }
2045- else if (modified)
2046- return std::move (expr);
2047- else
2048- return {};
2049- }
2050-
20511997void goto_check_ct::memory_leak_check (const irep_idt &function_id)
20521998{
20531999 const symbolt &leak = ns.lookup (CPROVER_PREFIX " memory_leak" );
@@ -2267,8 +2213,6 @@ void goto_check_ct::goto_check(
22672213 }
22682214 }
22692215
2270- i.transform ([this ](exprt expr) { return expand_pointer_checks (expr); });
2271-
22722216 for (auto &instruction : new_code.instructions )
22732217 {
22742218 if (instruction.source_location ().is_nil ())
0 commit comments