File tree Expand file tree Collapse file tree 4 files changed +39
-1
lines changed
regression/cbmc/pragma_cprover3 Expand file tree Collapse file tree 4 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ The goto-instrument program supports these checks:
122122| `--bounds-check` | add array bounds checks |
123123| `--div-by-zero-check` | add division by zero checks |
124124| `--pointer-check` | add pointer checks |
125+ | `--pointer-primitive-check` | add pointer primitive checks |
125126| `--signed-overflow-check` | add arithmetic over- and underflow checks |
126127| `--unsigned-overflow-check` | add arithmetic over- and underflow checks |
127128| `--undefined-shift-check` | add range checks for shift distances |
Original file line number Diff line number Diff line change 1+ #include <stdlib.h>
2+
3+ int main ()
4+ {
5+ char * p = malloc (sizeof (* p ));
6+ char * q ;
7+
8+ #pragma CPROVER check push
9+ #pragma CPROVER check disable "pointer-primitive"
10+ // do not generate checks for the following statements
11+ if (__CPROVER_same_object (p , q ))
12+ {
13+ }
14+ #pragma CPROVER check pop
15+
16+ // generate check and fail on the following statements
17+ if (__CPROVER_same_object (p , q ))
18+ {
19+ }
20+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+ --pointer-primitive-check
4+ ^main.c function main$
5+ ^\[main.pointer_primitives.\d+\] line 17 pointer invalid in POINTER_OBJECT\(\(const void \*\)p\): SUCCESS$
6+ ^\[main.pointer_primitives.\d+\] line 17 deallocated dynamic object in POINTER_OBJECT\(\(const void \*\)p\): SUCCESS$
7+ ^\[main.pointer_primitives.\d+\] line 17 dead object in POINTER_OBJECT\(\(const void \*\)p\): SUCCESS$
8+ ^\[main.pointer_primitives.\d+\] line 17 pointer outside object bounds in POINTER_OBJECT\(\(const void \*\)p\): SUCCESS$
9+ ^\[main.pointer_primitives.\d+\] line 17 pointer invalid in POINTER_OBJECT\(\(const void \*\)q\): FAILURE$
10+ ^\[main.pointer_primitives.\d+\] line 17 deallocated dynamic object in POINTER_OBJECT\(\(const void \*\)q\): SUCCESS$
11+ ^\[main.pointer_primitives.\d+\] line 17 dead object in POINTER_OBJECT\(\(const void \*\)q\): SUCCESS$
12+ ^\[main.pointer_primitives.\d+\] line 17 pointer outside object bounds in POINTER_OBJECT\(\(const void \*\)q\): FAILURE$
13+ ^VERIFICATION FAILED$
14+ ^EXIT=10$
15+ ^SIGNAL=0$
16+ --
Original file line number Diff line number Diff line change @@ -234,9 +234,10 @@ CPROVER_PREFIX "__CPROVER_"
234234
235235arith_check (" conversion" | " undefined-shift" | " nan" | " div-by-zero" )
236236enum_check " enum-range"
237+ pointer_primitive " pointer-primitive"
237238memory_check (" bounds" | " pointer" | " memory_leak" )
238239overflow_check (" signed" | " unsigned" | " pointer" | " float" )" -overflow"
239- named_check [" ]({arith_check }| {enum_check }| {memory_check }| {overflow_check })[" ]
240+ named_check [" ]({arith_check }| {enum_check }| {memory_check }| {overflow_check }| { pointer_primitive } )[" ]
240241
241242%x GRAMMAR
242243%x COMMENT1
You can’t perform that action at this time.
0 commit comments