-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Boogie Backend] Use the original names of variables when generating …
…Boogie (#2902) For MIR variables that map to a user variable in the source code, use their name in the source code in the generated Boogie. If there are multiple occurrences (due to SSA), append a `_i` to the variable name, where `i` is 0, 1, ... This change allows one to refer to the original variable name when adding contracts (e.g. loop invariants) in the output Boogie. Example: For the following Rust program: ```rust #[kani::proof] fn main() { let mut x = 41; let mut y = 43; x = 42; y = 42; kani::assert(x == y, ""); } ``` before this change, the generated Boogie was: ``` // Procedures: procedure _RNvCsjrUp1z5o1KH_5test64main() { var _1: int; var _2: int; var _4: bool; var _5: int; var _6: int; _1 := 41; _2 := 43; _1 := 42; _2 := 42; _5 := _1; _6 := _2; _4 := (_5 == _6); assert _4; return; } ``` but with this change, the generated Boogie is: ``` // Procedures: procedure _RNvCsjrUp1z5o1KH_5test64main() { var x: int; var y: int; var _4: bool; var _5: int; var _6: int; x := 41; y := 43; x := 42; y := 42; _5 := x; _6 := y; _4 := (_5 == _6); assert _4; return; } ``` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
- Loading branch information
1 parent
4084842
commit d518ae1
Showing
2 changed files
with
58 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
tests/expected/boogie/hello/test__RNvCs9oo0zocGbI4_4test19check_boogie_option.symtab.bpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Procedures: | ||
procedure _RNvCs9oo0zocGbI4_4test19check_boogie_option() | ||
{ | ||
return; | ||
} |