Skip to content

Commit 59f706c

Browse files
author
Remi Delmas
committed
Tentative: pointers are invalid when pointer predicates return false.
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.
1 parent dfed234 commit 59f706c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ansi-c/library/cprover_contracts.c

+8
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,8 @@ __CPROVER_HIDE:;
12061206
}
12071207
if(__VERIFIER_nondet___CPROVER_bool())
12081208
{
1209+
__CPROVER_size_t dummy = __VERIFIER_nondet_size();
1210+
*elem = (void *) dummy;
12091211
return 0;
12101212
}
12111213
void *ptr = __CPROVER_allocate(size, 0);
@@ -1263,6 +1265,8 @@ __CPROVER_HIDE:;
12631265
}
12641266
if(__VERIFIER_nondet___CPROVER_bool())
12651267
{
1268+
__CPROVER_size_t dummy = __VERIFIER_nondet_size();
1269+
*elem = (void *) dummy;
12661270
return 0;
12671271
}
12681272
void *ptr = __CPROVER_allocate(size, 0);
@@ -1365,7 +1369,11 @@ __CPROVER_HIDE:;
13651369
if(write_set->assume_requires_ctx | write_set->assume_ensures_ctx)
13661370
{
13671371
if(__VERIFIER_nondet___CPROVER_bool())
1372+
{
1373+
__CPROVER_size_t dummy = __VERIFIER_nondet_size();
1374+
*ptr = (void *)dummy;
13681375
return 0;
1376+
}
13691377

13701378
// add nondet offset
13711379
__CPROVER_size_t offset = __VERIFIER_nondet_size();

0 commit comments

Comments
 (0)