@@ -103,6 +103,8 @@ class goto_check_ct
103103 using guardt = std::function<exprt(exprt)>;
104104 const guardt identity = [](exprt expr) { return expr; };
105105
106+ void check_shadow_memory_api_calls (const goto_programt::instructiont &);
107+
106108 // / Check an address-of expression:
107109 // / if it is a dereference then check the pointer
108110 // / if it is an index then address-check the array and then check the index
@@ -2142,6 +2144,8 @@ void goto_check_ct::goto_check(
21422144 for (const auto &arg : i.call_arguments ())
21432145 check (arg);
21442146
2147+ check_shadow_memory_api_calls (i);
2148+
21452149 // the call might invalidate any assertion
21462150 assertions.clear ();
21472151 }
@@ -2243,6 +2247,25 @@ void goto_check_ct::goto_check(
22432247 remove_skip (goto_program);
22442248}
22452249
2250+ void goto_check_ct::check_shadow_memory_api_calls (
2251+ const goto_programt::instructiont &i)
2252+ {
2253+ if (i.call_function ().id () != ID_symbol)
2254+ return ;
2255+
2256+ const irep_idt &identifier =
2257+ to_symbol_expr (i.call_function ()).get_identifier ();
2258+
2259+ if (
2260+ identifier == CPROVER_PREFIX " get_field" || identifier == CPROVER_PREFIX
2261+ " set_field" )
2262+ {
2263+ const exprt &expr = i.call_arguments ()[0 ];
2264+ PRECONDITION (expr.type ().id () == ID_pointer);
2265+ check (dereference_exprt (expr));
2266+ }
2267+ }
2268+
22462269goto_check_ct::conditionst
22472270goto_check_ct::get_pointer_points_to_valid_memory_conditions (
22482271 const exprt &address,
0 commit comments