@@ -103,6 +103,8 @@ class goto_check_ct
103
103
using guardt = std::function<exprt(exprt)>;
104
104
const guardt identity = [](exprt expr) { return expr; };
105
105
106
+ void check_shadow_memory_api_calls (const goto_programt::instructiont &);
107
+
106
108
// / Check an address-of expression:
107
109
// / if it is a dereference then check the pointer
108
110
// / 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(
2142
2144
for (const auto &arg : i.call_arguments ())
2143
2145
check (arg);
2144
2146
2147
+ check_shadow_memory_api_calls (i);
2148
+
2145
2149
// the call might invalidate any assertion
2146
2150
assertions.clear ();
2147
2151
}
@@ -2243,6 +2247,25 @@ void goto_check_ct::goto_check(
2243
2247
remove_skip (goto_program);
2244
2248
}
2245
2249
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
+
2246
2269
goto_check_ct::conditionst
2247
2270
goto_check_ct::get_pointer_points_to_valid_memory_conditions (
2248
2271
const exprt &address,
0 commit comments