Skip to content

Use correct type for pointer checks in contracts #6164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions regression/contracts/assigns_replace_03/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
KNOWNBUG
CORE
main.c
--replace-all-calls-with-contracts
^EXIT=0$
Expand All @@ -7,7 +7,3 @@ main.c
--
--
This test checks that a havocked variable can be constrained by a function post-condition.

Known Bug:
Currently, there is a bug when char variables are being passed to
__CPROVER_w_ok(). See GitHub issue #6106 for further details.
6 changes: 3 additions & 3 deletions src/goto-instrument/code_contracts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1698,7 +1698,7 @@ goto_programt assigns_clauset::havoc_code(
{
// create the condition
exprt condition =
not_exprt(w_ok_exprt(target_ptr, from_integer(0, integer_typet())));
not_exprt(w_ok_exprt(target_ptr, from_integer(0, unsigned_int_type())));
havoc_statements.add(goto_programt::make_goto(z, condition, location));
}

Expand Down Expand Up @@ -1775,8 +1775,8 @@ exprt assigns_clauset::compatible_expression(
// target->compatible_expression(*called_target) would not be
// checked on invalid called_targets.
current_target_compatible = or_exprt(
not_exprt(
w_ok_exprt(called_target_ptr, from_integer(0, integer_typet()))),
not_exprt(w_ok_exprt(
called_target_ptr, from_integer(0, unsigned_int_type()))),
target->compatible_expression(*called_target));
}
else
Expand Down