Skip to content

Commit 9539a51

Browse files
authored
Merge pull request #6164 from padhi-aws-forks/assigns_w_ok_bug_fix
Use correct type for pointer checks in contracts
2 parents f5f965a + 45cb253 commit 9539a51

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG
1+
CORE
22
main.c
33
--replace-all-calls-with-contracts
44
^EXIT=0$
@@ -7,7 +7,3 @@ main.c
77
--
88
--
99
This test checks that a havocked variable can be constrained by a function post-condition.
10-
11-
Known Bug:
12-
Currently, there is a bug when char variables are being passed to
13-
__CPROVER_w_ok(). See GitHub issue #6106 for further details.

src/goto-instrument/code_contracts.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,7 +1698,7 @@ goto_programt assigns_clauset::havoc_code(
16981698
{
16991699
// create the condition
17001700
exprt condition =
1701-
not_exprt(w_ok_exprt(target_ptr, from_integer(0, integer_typet())));
1701+
not_exprt(w_ok_exprt(target_ptr, from_integer(0, unsigned_int_type())));
17021702
havoc_statements.add(goto_programt::make_goto(z, condition, location));
17031703
}
17041704

@@ -1775,8 +1775,8 @@ exprt assigns_clauset::compatible_expression(
17751775
// target->compatible_expression(*called_target) would not be
17761776
// checked on invalid called_targets.
17771777
current_target_compatible = or_exprt(
1778-
not_exprt(
1779-
w_ok_exprt(called_target_ptr, from_integer(0, integer_typet()))),
1778+
not_exprt(w_ok_exprt(
1779+
called_target_ptr, from_integer(0, unsigned_int_type()))),
17801780
target->compatible_expression(*called_target));
17811781
}
17821782
else

0 commit comments

Comments
 (0)