Skip to content

Commit

Permalink
Propogate backend options into goto-synthesizer (rust-lang#2643)
Browse files Browse the repository at this point in the history
`goto-synthesizer` should take the same backend options as `cbmc` to
make sure that the checker we used to check loop-contracts candidates is
the same as the checker we verify the final goto-binary.
  • Loading branch information
qinheping authored Oct 30, 2023
1 parent ff9d5eb commit 24bb480
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions kani-driver/src/call_goto_synthesizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,18 @@ impl KaniSession {
output.to_owned().into_os_string(), // output
];

// goto-synthesizer should take the same backend options as cbmc.
// Backend options include
// 1. solver options
self.handle_solver_args(&harness_metadata.attributes.solver, &mut args)?;
// 2. object-bits option
if let Some(object_bits) = self.args.cbmc_object_bits() {
args.push("--object-bits".into());
args.push(object_bits.to_string().into());
}
// 3. and array-as-uninterpreted-functions options, which should be included
// in the cbmc_args.
args.extend(self.args.cbmc_args.iter().cloned());

let mut cmd = Command::new("goto-synthesizer");
cmd.args(args);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT

// kani-flags: --enable-unstable --synthesize-loop-contracts
// kani-flags: --enable-unstable --synthesize-loop-contracts --cbmc-args --object-bits 4

// Check if goto-synthesizer is correctly called, and synthesizes the required
// loop invariants.
Expand Down

0 comments on commit 24bb480

Please sign in to comment.