Skip to content

Commit da86bdb

Browse files
author
Daniel Kroening
authored
Merge pull request #2602 from diffblue/__CPROVER_r/w_ok
__CPROVER_r_ok and __CPROVER_w_ok preconditions
2 parents 0618f7d + 0202f34 commit da86bdb

File tree

11 files changed

+246
-192
lines changed

11 files changed

+246
-192
lines changed

doc/cbmc-user-manual.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,6 +2190,15 @@ to the program. If the expression evaluates to false, the execution
21902190
aborts without failure. More detail on the use of assumptions is in the
21912191
section on [Assumptions and Assertions](modeling-assertions.shtml).
21922192

2193+
#### \_\_CPROVER\_r_ok, \_\_CPROVER\_w_ok
2194+
2195+
void __CPROVER_r_ok(const void *, size_t size);
2196+
void __CPROVER_w_ok(cosnt void *, size_t size);
2197+
2198+
The function **\_\_CPROVER\_r_ok** returns true if reading the piece of
2199+
memory starting at the given pointer with the given size is safe.
2200+
**\_\_CPROVER\_w_ok** does the same with writing.
2201+
21932202
#### \_\_CPROVER\_same\_object, \_\_CPROVER\_POINTER\_OBJECT, \_\_CPROVER\_POINTER\_OFFSET, \_\_CPROVER\_DYNAMIC\_OBJECT
21942203

21952204
_Bool __CPROVER_same_object(const void *, const void *);

regression/cbmc/memcpy1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ main.c
44
^EXIT=10$
55
^SIGNAL=0$
66
^VERIFICATION FAILED$
7-
\[(__builtin___memcpy_chk|memcpy)\.pointer_dereference\.[0-9]+\] dereference failure: pointer outside object bounds in \*\(\(\(const char \*\)src \+ \(signed (long (long )?)?int\)n\) - (\(signed long (long )?int\))?1\): FAILURE$
7+
^\[main\.precondition_instance\..*\] memcpy source region readable: FAILURE$
88
\*\* 1 of [0-9]+ failed
99
--
1010
^warning: ignoring

regression/cbmc/memset1/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ main.c
44
^EXIT=10$
55
^SIGNAL=0$
66
^VERIFICATION FAILED$
7-
\[main.assertion.7\] assertion A\[1\]==0x01010111: FAILURE
8-
\*\* 1 of 12 failed
7+
^\[main.assertion.7\] assertion A\[1\]==0x01010111: FAILURE$
8+
\*\* 1 of [0-9]+ failed
99
--
1010
^warning: ignoring

regression/cbmc/memset3/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ main.c
44
^EXIT=10$
55
^SIGNAL=0$
66
^VERIFICATION FAILED$
7-
\[.*] dereference failure: pointer outside dynamic object bounds in .*: FAILURE
8-
\*\* 2 of .* failed \(.*\)
7+
^\[main\.precondition_instance\..*] memset destination region writeable: FAILURE$
8+
\*\* 1 of [0-9]+ failed \(.*\)
99
--
1010
^warning: ignoring

0 commit comments

Comments
 (0)