@@ -403,63 +403,24 @@ bool ai_baset::do_function_call_rec(
403403{
404404 PRECONDITION (!goto_functions.function_map .empty ());
405405
406- // We can't really do this here -- we rely on
407- // these being removed by some previous analysis.
408- PRECONDITION (function.id () != ID_dereference);
409-
410- // Can't be a function
406+ // This is quite a strong assumption on the well-formedness of the program.
407+ // It means function pointers must be removed before use.
411408 DATA_INVARIANT (
412- function.id () != " NULL-object" , " Function cannot be null object" );
413- DATA_INVARIANT (function.id () != ID_member, " Function cannot be struct field" );
414- DATA_INVARIANT (function.id () != ID_index, " Function cannot be array element" );
409+ function.id () == ID_symbol,
410+ " Function pointers and indirect calls must be removed before analysis." );
415411
416412 bool new_data=false ;
417413
418- if (function.id ()==ID_symbol)
419- {
420- const irep_idt &identifier = to_symbol_expr (function).get_identifier ();
414+ const irep_idt &identifier = to_symbol_expr (function).get_identifier ();
421415
422- goto_functionst::function_mapt::const_iterator it=
423- goto_functions.function_map .find (identifier);
416+ goto_functionst::function_mapt::const_iterator it =
417+ goto_functions.function_map .find (identifier);
424418
425- if (it== goto_functions.function_map .end ())
426- throw " failed to find function " + id2string (identifier);
419+ if (it == goto_functions.function_map .end ())
420+ throw " failed to find function " + id2string (identifier);
427421
428- new_data=do_function_call (
429- l_call, l_return,
430- goto_functions,
431- it,
432- arguments,
433- ns);
434- }
435- else if (function.id ()==ID_if)
436- {
437- DATA_INVARIANT (function.operands ().size () != 3 , " if has three operands" );
438-
439- bool new_data1=
440- do_function_call_rec (
441- l_call, l_return,
442- function.op1 (),
443- arguments,
444- goto_functions,
445- ns);
446-
447- bool new_data2=
448- do_function_call_rec (
449- l_call, l_return,
450- function.op2 (),
451- arguments,
452- goto_functions,
453- ns);
454-
455- if (new_data1 || new_data2)
456- new_data=true ;
457- }
458- else
459- {
460- throw " unexpected function_call argument: " +
461- function.id_string ();
462- }
422+ new_data =
423+ do_function_call (l_call, l_return, goto_functions, it, arguments, ns);
463424
464425 return new_data;
465426}
0 commit comments