Skip to content

Commit 24bb480

Browse files
authored
Propogate backend options into goto-synthesizer (#2643)
`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.
1 parent ff9d5eb commit 24bb480

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

kani-driver/src/call_goto_synthesizer.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,18 @@ impl KaniSession {
3535
output.to_owned().into_os_string(), // output
3636
];
3737

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

4051
let mut cmd = Command::new("goto-synthesizer");
4152
cmd.args(args);

tests/ui/loop-contracts-synthesis/main_unsigned/main_unsigned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright Kani Contributors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

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

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

0 commit comments

Comments
 (0)