@@ -1225,69 +1225,6 @@ goto_functionst &code_contractst::get_goto_functions()
12251225 return goto_functions;
12261226}
12271227
1228- bool code_contractst::check_for_looped_mallocs (const goto_programt &program)
1229- {
1230- // Collect all GOTOs and mallocs
1231- std::vector<goto_programt::instructiont> back_gotos;
1232- std::vector<goto_programt::instructiont> malloc_calls;
1233-
1234- int index = 0 ;
1235- for (goto_programt::instructiont instruction : program.instructions )
1236- {
1237- if (instruction.is_backwards_goto ())
1238- {
1239- back_gotos.push_back (instruction);
1240- }
1241- if (instruction.is_function_call ())
1242- {
1243- irep_idt called_name;
1244- if (instruction.call_function ().id () == ID_dereference)
1245- {
1246- called_name =
1247- to_symbol_expr (
1248- to_dereference_expr (instruction.call_function ()).pointer ())
1249- .get_identifier ();
1250- }
1251- else
1252- {
1253- called_name =
1254- to_symbol_expr (instruction.call_function ()).get_identifier ();
1255- }
1256-
1257- if (called_name == " malloc" )
1258- {
1259- malloc_calls.push_back (instruction);
1260- }
1261- }
1262- index++;
1263- }
1264- // Make sure there are no gotos that go back such that a malloc
1265- // is between the goto and its destination (possible loop).
1266- for (auto goto_entry : back_gotos)
1267- {
1268- for (const auto &target : goto_entry.targets )
1269- {
1270- for (auto malloc_entry : malloc_calls)
1271- {
1272- if (
1273- malloc_entry.location_number >= target->location_number &&
1274- malloc_entry.location_number < goto_entry.location_number )
1275- {
1276- log.error () << " Call to malloc at location "
1277- << malloc_entry.location_number << " falls between goto "
1278- << " source location " << goto_entry.location_number
1279- << " and it's destination at location "
1280- << target->location_number << " . "
1281- << " Unable to complete instrumentation, as this malloc "
1282- << " may be in a loop." << messaget::eom;
1283- throw 0 ;
1284- }
1285- }
1286- }
1287- }
1288- return false ;
1289- }
1290-
12911228bool code_contractst::check_frame_conditions_function (const irep_idt &function)
12921229{
12931230 // Get the function object before instrumentation.
0 commit comments