@@ -513,50 +513,38 @@ void code_contractst::instrument_call_statement(
513
513
514
514
exprt called_assigns =
515
515
to_code_with_contract_type (called_symbol.type ).assigns ();
516
- if (called_assigns.is_nil ()) // Called function has no assigns clause
517
- {
518
- // Create a false assertion, so the analysis
519
- // will fail if this function is called.
520
- goto_programt failing_assertion;
521
- failing_assertion.add (goto_programt::make_assertion (
522
- false_exprt (), instruction_iterator->source_location ));
523
- program.insert_before_swap (instruction_iterator, failing_assertion);
524
- ++instruction_iterator;
525
-
526
- return ;
527
- }
528
- else // Called function has assigns clause
516
+ if (!called_assigns.is_nil ()) // Called function has assigns clause
517
+ {
518
+ replace_symbolt replace;
519
+ // Replace formal parameters
520
+ code_function_callt::argumentst::const_iterator a_it =
521
+ call.arguments ().begin ();
522
+ for (code_typet::parameterst::const_iterator p_it =
523
+ called_type.parameters ().begin ();
524
+ p_it != called_type.parameters ().end () &&
525
+ a_it != call.arguments ().end ();
526
+ ++p_it, ++a_it)
529
527
{
530
- replace_symbolt replace;
531
- // Replace formal parameters
532
- code_function_callt::argumentst::const_iterator a_it =
533
- call.arguments ().begin ();
534
- for (code_typet::parameterst::const_iterator p_it =
535
- called_type.parameters ().begin ();
536
- p_it != called_type.parameters ().end () &&
537
- a_it != call.arguments ().end ();
538
- ++p_it, ++a_it)
528
+ if (!p_it->get_identifier ().empty ())
539
529
{
540
- if (!p_it->get_identifier ().empty ())
541
- {
542
- symbol_exprt p (p_it->get_identifier (), p_it->type ());
543
- replace.insert (p, *a_it);
544
- }
530
+ symbol_exprt p (p_it->get_identifier (), p_it->type ());
531
+ replace.insert (p, *a_it);
545
532
}
546
-
547
- replace (called_assigns);
548
-
549
- // check compatibility of assigns clause with the called function
550
- assigns_clauset called_assigns_clause (
551
- called_assigns, *this , function_id, log );
552
- exprt compatible =
553
- assigns_clause.compatible_expression (called_assigns_clause);
554
- goto_programt alias_assertion;
555
- alias_assertion.add (goto_programt::make_assertion (
556
- compatible, instruction_iterator->source_location ));
557
- program.insert_before_swap (instruction_iterator, alias_assertion);
558
- ++instruction_iterator;
559
533
}
534
+
535
+ replace (called_assigns);
536
+
537
+ // check compatibility of assigns clause with the called function
538
+ assigns_clauset called_assigns_clause (
539
+ called_assigns, *this , function_id, log );
540
+ exprt compatible =
541
+ assigns_clause.compatible_expression (called_assigns_clause);
542
+ goto_programt alias_assertion;
543
+ alias_assertion.add (goto_programt::make_assertion (
544
+ compatible, instruction_iterator->source_location ));
545
+ program.insert_before_swap (instruction_iterator, alias_assertion);
546
+ ++instruction_iterator;
547
+ }
560
548
}
561
549
562
550
bool code_contractst::check_for_looped_mallocs (const goto_programt &program)
@@ -634,9 +622,6 @@ bool code_contractst::add_pointer_checks(const std::string &function_name)
634
622
const auto &type = to_code_with_contract_type (function_symbol.type );
635
623
636
624
exprt assigns_expr = type.assigns ();
637
- // Return if there are no reference checks to perform.
638
- if (assigns_expr.is_nil ())
639
- return false ;
640
625
641
626
assigns_clauset assigns (assigns_expr, *this , function_id, log );
642
627
0 commit comments