Skip to content

Commit

Permalink
Tentative: pointers are invalid when pointer predicates return false.
Browse files Browse the repository at this point in the history
Modifies the semantics of is_fresh and pointer_in_range_dfcc to
make pointers invalid in the `false` case. Solves the performance
blowup when pointer predicates are used in combination with
nondet-pointer for contract replacement.
Soundness needs to be reviewed/discussed.
  • Loading branch information
Remi Delmas committed Jan 13, 2025
1 parent dfed234 commit 59f706c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ansi-c/library/cprover_contracts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,8 @@ __CPROVER_HIDE:;
}
if(__VERIFIER_nondet___CPROVER_bool())
{
__CPROVER_size_t dummy = __VERIFIER_nondet_size();
*elem = (void *) dummy;
return 0;
}
void *ptr = __CPROVER_allocate(size, 0);
Expand Down Expand Up @@ -1263,6 +1265,8 @@ __CPROVER_HIDE:;
}
if(__VERIFIER_nondet___CPROVER_bool())
{
__CPROVER_size_t dummy = __VERIFIER_nondet_size();
*elem = (void *) dummy;
return 0;
}
void *ptr = __CPROVER_allocate(size, 0);
Expand Down Expand Up @@ -1365,7 +1369,11 @@ __CPROVER_HIDE:;
if(write_set->assume_requires_ctx | write_set->assume_ensures_ctx)
{
if(__VERIFIER_nondet___CPROVER_bool())
{
__CPROVER_size_t dummy = __VERIFIER_nondet_size();
*ptr = (void *)dummy;
return 0;
}

// add nondet offset
__CPROVER_size_t offset = __VERIFIER_nondet_size();
Expand Down

0 comments on commit 59f706c

Please sign in to comment.