-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ITE and binary relations are constant when all operands are constants
This expands the definition of is_constantt to cover if-then-else as well as binary relations. In many, but not, cases the simplifier will have turned these into simpler constants. The included regression test is derived from Rust code, where the intermediate representation (together with constant propagation) will yield such comparisons.
- Loading branch information
1 parent
1efed70
commit f926d2b
Showing
3 changed files
with
20 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
int main(void) | ||
{ | ||
int x; | ||
int plus_one_is_null = &x + 1 == (int *)0 ? 1 : 0; | ||
__CPROVER_assert(plus_one_is_null != 2, "cannot be 2"); | ||
|
||
return 0; | ||
} |
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,9 @@ | ||
CORE new-smt-backend | ||
main.c | ||
|
||
^Generated 1 VCC\(s\), 0 remaining after simplification$ | ||
^VERIFICATION SUCCESSFUL$ | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring |
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