Skip to content

Create new __CPROVER_havoc_slice & __CPROVER_havoc_from primitives #6351

@jimgrundy

Description

@jimgrundy

We need the following new havoc primitives in CBMC:

void __CPROVER_havoc_slice(void *p, size_t s);
void __CPROVER_havoc_from (void *p);

(Reference implementation for havoc_object: symex_other.cpp)

The semantics of these primitives are described below.

__CPROVER_havoc_slice(void *p, size_t s)

Precondition:

s == 0 || __CPROVER_w_ok(p, s)
  • If s is zero then no action is performed.
  • If s is non-zero and p is a valid pointer to an object with at least s writable bytes starting at address p, that is if __CPROVER_w_ok(p, s), then the effect is to replace the s bytes starting at address p with fresh symbolic values.

__CPROVER_havoc_from(void *p)

Precondition:

p == NULL ||
     __CPROVER_OBJECT_SIZE(p) == __CPROVER_POINTER_OFFSET(p) ||
     __CPROVER_w_ok(p, __CPROVER_OBJECT_SIZE(p) - __CPROVER_POINTER_OFFSET(p))
  • If p is NULL then no action is performed.
  • Otherwise, equivalent to:
    __CPROVER_havoc_slice(p, __CPROVER_OBJECT_SIZE(p) - __CPROVER_POINTER_OFFSET(p))

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions