@@ -578,11 +578,15 @@ void dfcc_wrapper_programt::encode_requires_clauses()
578578 memory_predicates.fix_calls (requires_program);
579579
580580 // instrument for side effects
581+ // make the program well-formed
582+ requires_program.add (goto_programt::make_end_function ());
581583 instrument.instrument_goto_program (
582584 wrapper_id,
583585 requires_program,
584586 addr_of_requires_write_set,
585587 function_pointer_contracts);
588+ // turn it back into a sequence of statements
589+ requires_program.instructions .back ().turn_into_skip ();
586590
587591 // append resulting program to preconditions section
588592 preconditions.destructive_append (requires_program);
@@ -637,11 +641,15 @@ void dfcc_wrapper_programt::encode_ensures_clauses()
637641 memory_predicates.fix_calls (ensures_program);
638642
639643 // instrument for side effects
644+ // make the program well-formed
645+ ensures_program.add (goto_programt::make_end_function ());
640646 instrument.instrument_goto_program (
641647 wrapper_id,
642648 ensures_program,
643649 addr_of_ensures_write_set,
644650 function_pointer_contracts);
651+ // turn it back into a sequence of statements
652+ ensures_program.instructions .back ().turn_into_skip ();
645653
646654 // add the ensures program to the postconditions section
647655 postconditions.destructive_append (ensures_program);
0 commit comments