Skip to content

Commit 5cfcbc4

Browse files
authored
Merge pull request #8045 from tautschnig/bugfixes/7866-bounds
DFCC instrumentation: ensure programs are well-formed
2 parents 7d3c5c4 + 91380f4 commit 5cfcbc4

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.github/workflows/pull-request-checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ jobs:
432432
echo "CCACHE_BASEDIR=$PWD" >> $GITHUB_ENV
433433
echo "CCACHE_DIR=$PWD/.ccache" >> $GITHUB_ENV
434434
- name: Configure using CMake
435-
run: cmake -S . -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release
435+
run: cmake -S . -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-Wp,-D_GLIBCXX_ASSERTIONS
436436
- name: Zero ccache stats and limit in size
437437
run: ccache -z --max-size=500M
438438
- name: Build with Ninja

src/goto-instrument/contracts/dynamic-frames/dfcc_wrapper_program.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)