Skip to content

Commit 57d6915

Browse files
committed
C/C++ library: move free/delete-only definitions to library
With the support of building initialisers while adding the library we can move library-only symbols to the library. This avoids polluting the initialisation function for all cases that don't actually use memory (de-)allocation library functions.
1 parent 72961aa commit 57d6915

File tree

72 files changed

+371
-366
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+371
-366
lines changed

regression/cbmc-library/alloca-02/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
void *alloca(size_t alloca_size);
55
#endif
66

7+
// intentionally type conflicting: the built-in library uses const void*; this
8+
// is to check that object type updates are performed
9+
extern const char *__CPROVER_alloca_object;
10+
711
int *foo()
812
{
913
int *foo_ptr = alloca(sizeof(int));
14+
__CPROVER_assert(foo_ptr == __CPROVER_alloca_object, "may fail");
1015
return foo_ptr;
1116
}
1217

regression/cbmc-library/alloca-02/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ CORE
22
main.c
33
--pointer-check
44
dereference failure: dead object in \*from_foo: FAILURE$
5-
^\*\* 1 of 6 failed
5+
^\*\* 2 of 7 failed
66
^VERIFICATION FAILED$
77
^EXIT=10$
88
^SIGNAL=0$

regression/cbmc/xml-escaping/debug_output.desc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ main.c
44
^EXIT=10$
55
^SIGNAL=0$
66
VERIFICATION FAILED
7-
⇔ false
87
\¬main\:\:1\:\:x\!0\@1\#1
98
--
109
XML does not support escaping non-printable character

regression/cprover/arrays/array1.desc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ array1.c
33
--text --solve --inline --no-safety
44
^EXIT=10$
55
^SIGNAL=0$
6-
^\(\d+\) ∀ ς : state \. S19\(ς\) ⇒ S20\(ς\[element_address\(❝array❞, .*1.*\):=10\]\)$
7-
^\(\d+\) ∀ ς : state \. S20\(ς\) ⇒ S21\(ς\[element_address\(❝array❞, .*2.*\):=20\]\)$
8-
^\(\d+\) ∀ ς : state \. S21\(ς\) ⇒ \(ς\(element_address\(❝array❞, .*1.*\)\) = 10\)$
9-
^\(\d+\) ∀ ς : state \. S22\(ς\) ⇒ \(ς\(element_address\(❝array❞, .*2.*\)\) = 20\)$
10-
^\(\d+\) ∀ ς : state \. S23\(ς\) ⇒ \(ς\(element_address\(❝array❞, .*2.*\)\) = 30\)$
6+
^\(\d+\) ∀ ς : state \. S16\(ς\) ⇒ S17\(ς\[element_address\(❝array❞, .*1.*\):=10\]\)$
7+
^\(\d+\) ∀ ς : state \. S17\(ς\) ⇒ S18\(ς\[element_address\(❝array❞, .*2.*\):=20\]\)$
8+
^\(\d+\) ∀ ς : state \. S18\(ς\) ⇒ \(ς\(element_address\(❝array❞, .*1.*\)\) = 10\)$
9+
^\(\d+\) ∀ ς : state \. S19\(ς\) ⇒ \(ς\(element_address\(❝array❞, .*2.*\)\) = 20\)$
10+
^\(\d+\) ∀ ς : state \. S20\(ς\) ⇒ \(ς\(element_address\(❝array❞, .*2.*\)\) = 30\)$
1111
^\[main\.assertion\.1\] line \d+ property 1: SUCCESS$
1212
^\[main\.assertion\.2\] line \d+ property 2: SUCCESS$
1313
^\[main\.assertion\.3\] line \d+ property 3: REFUTED$

regression/cprover/arrays/array2.desc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ array2.c
33
--text --solve --inline --no-safety
44
^EXIT=10$
55
^SIGNAL=0$
6-
^\(\d+\) ∀ ς : state \. \(S22\(ς\) ∧ ς\(❝main::1::i❞\) = ς\(❝main::1::j❞\)\) ⇒ S23\(ς\)$
7-
^\(\d+\) ∀ ς : state \. S23\(ς\) ⇒ \(ς\(element_address\(❝main::1::array❞, cast\(ς\(❝main::1::i❞\), signedbv\[64\]\)\)\) = ς\(element_address\(❝main::1::array❞, cast\(ς\(❝main::1::j❞\), signedbv\[64\]\)\)\)\)$
8-
^\(\d+\) ∀ ς : state \. S24\(ς\) ⇒ \(ς\(element_address\(❝main::1::array❞, cast\(ς\(❝main::1::i❞\), signedbv\[64\]\)\)\) = ς\(element_address\(❝main::1::array❞, cast\(ς\(❝main::1::k❞\), signedbv\[64\]\)\)\)\)$
6+
^\(\d+\) ∀ ς : state \. \(S19\(ς\) ∧ ς\(❝main::1::i❞\) = ς\(❝main::1::j❞\)\) ⇒ S20\(ς\)$
7+
^\(\d+\) ∀ ς : state \. S20\(ς\) ⇒ \(ς\(element_address\(❝main::1::array❞, cast\(ς\(❝main::1::i❞\), signedbv\[64\]\)\)\) = ς\(element_address\(❝main::1::array❞, cast\(ς\(❝main::1::j❞\), signedbv\[64\]\)\)\)\)$
8+
^\(\d+\) ∀ ς : state \. S21\(ς\) ⇒ \(ς\(element_address\(❝main::1::array❞, cast\(ς\(❝main::1::i❞\), signedbv\[64\]\)\)\) = ς\(element_address\(❝main::1::array❞, cast\(ς\(❝main::1::k❞\), signedbv\[64\]\)\)\)\)$
99
^\[main\.assertion\.1\] line \d+ property 1: SUCCESS$
1010
^\[main\.assertion\.2\] line \d+ property 2: REFUTED$
1111
--

regression/cprover/basic/assume1.desc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ assume1.c
66
^ \(\d+\) ∀ ς : state \. initial_state\(ς\) ⇒ SInitial\(ς\)$
77
^ \(\d+\) S0 = SInitial$
88
^ \(\d+\) S1 = S0$
9-
^\(\d+\) ∀ ς : state \. \(S19\(ς\) ∧ ς\(❝main::1::x❞\) ≥ 10\) ⇒ S20\(ς\)$
10-
^\(\d+\) ∀ ς : state \. S20\(ς\) ⇒ \(ς\(❝main::1::x❞\) ≥ 5\)$
11-
^\(\d+\) ∀ ς : state \. S21\(ς\) ⇒ \(ς\(❝main::1::x❞\) ≥ 15\)$
9+
^\(\d+\) ∀ ς : state \. \(S16\(ς\) ∧ ς\(❝main::1::x❞\) ≥ 10\) ⇒ S17\(ς\)$
10+
^\(\d+\) ∀ ς : state \. S17\(ς\) ⇒ \(ς\(❝main::1::x❞\) ≥ 5\)$
11+
^\(\d+\) ∀ ς : state \. S18\(ς\) ⇒ \(ς\(❝main::1::x❞\) ≥ 15\)$
1212
^\[main\.assertion\.1\] line \d+ property 1: SUCCESS$
1313
^\[main\.assertion\.2\] line \d+ property 2: REFUTED$
1414
--

regression/cprover/basic/basic1.desc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ basic1.c
55
^SIGNAL=0$
66
^ \(\d+\) ∀ ς : state \. initial_state\(ς\) ⇒ SInitial\(ς\)$
77
^ \(\d+\) S0 = SInitial$
8-
^\(\d+\) ∀ ς : state \. S16\(ς\) ⇒ S17\(ς\[❝x❞:=0\]\)$
9-
^\(\d+\) ∀ ς : state \. S19\(ς\) ⇒ S20\(ς\[❝x❞:=1\]\)$
10-
^\(\d+\) ∀ ς : state \. S20\(ς\) ⇒ \(ς\(❝x❞\) = 1\)$
8+
^\(\d+\) ∀ ς : state \. S13\(ς\) ⇒ S14\(ς\[❝x❞:=0\]\)$
9+
^\(\d+\) ∀ ς : state \. S16\(ς\) ⇒ S17\(ς\[❝x❞:=1\]\)$
10+
^\(\d+\) ∀ ς : state \. S17\(ς\) ⇒ \(ς\(❝x❞\) = 1\)$
1111
^\[main\.assertion\.1\] line \d+ property 1: SUCCESS$
1212
--

regression/cprover/basic/basic2.desc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ basic2.c
33
--text --solve --inline
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\(\d+\) ∀ ς : state \. S16\(ς\) ⇒ S17\(ς\[❝x❞:=0\]\)$
6+
^\(\d+\) ∀ ς : state \. S13\(ς\) ⇒ S14\(ς\[❝x❞:=0\]\)$
7+
^\(\d+\) S15 = S14$
8+
^\(\d+\) S16 = S15$
9+
^\(\d+\) ∀ ς : state \. S16\(ς\) ⇒ S17\(ς\[❝x❞:=1\]\)$
710
^\(\d+\) S18 = S17$
8-
^\(\d+\) S19 = S18$
9-
^\(\d+\) ∀ ς : state \. S19\(ς\) ⇒ S20\(ς\[❝x❞:=1\]\)$
10-
^\(\d+\) S21 = S20$
11-
^\(\d+\) ∀ ς : state \. S21\(ς\) ⇒ \(ς\(❝x❞\) = 1\)$
11+
^\(\d+\) ∀ ς : state \. S18\(ς\) ⇒ \(ς\(❝x❞\) = 1\)$
1212
^\[main\.assertion\.1\] line \d+ property 1: SUCCESS$
1313
--

regression/cprover/basic/basic3.desc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ basic3.c
33
--text --solve --inline
44
^EXIT=0$
55
^SIGNAL=0$
6-
\(\d+\) ∀ ς : state \. S16\(ς\) ⇒ S17\(ς\[❝x❞:=0\]\)
7-
\(\d+\) ∀ ς : state \. S17\(ς\) ⇒ S18\(ς\[❝y❞:=0\]\)
8-
\(\d+\) ∀ ς : state \. S20\(ς\) ⇒ S21\(ς\[❝x❞:=1\]\)
9-
\(\d+\) ∀ ς : state \. S21\(ς\) ⇒ S22\(ς\[❝y❞:=2\]\)
10-
\(\d+\) ∀ ς : state \. S22\(ς\) ⇒ \(ς\(❝x❞\) = 1\)
6+
\(\d+\) ∀ ς : state \. S13\(ς\) ⇒ S14\(ς\[❝x❞:=0\]\)
7+
\(\d+\) ∀ ς : state \. S14\(ς\) ⇒ S15\(ς\[❝y❞:=0\]\)
8+
\(\d+\) ∀ ς : state \. S17\(ς\) ⇒ S18\(ς\[❝x❞:=1\]\)
9+
\(\d+\) ∀ ς : state \. S18\(ς\) ⇒ S19\(ς\[❝y❞:=2\]\)
10+
\(\d+\) ∀ ς : state \. S19\(ς\) ⇒ \(ς\(❝x❞\) = 1\)
1111
^\[main\.assertion\.1\] line \d+ property 1: SUCCESS$
1212
--

regression/cprover/basic/basic4.desc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ basic4.c
33
--text --solve --inline
44
^EXIT=10$
55
^SIGNAL=0$
6-
^\(\d+\) ∀ ς : state \. S16\(ς\) ⇒ S17\(ς\[❝x❞:=0\]\)$
7-
^\(\d+\) ∀ ς : state \. S19\(ς\) ⇒ S20\(ς\[❝x❞:=1\]\)$
8-
^\(\d+\) ∀ ς : state \. S20\(ς\) ⇒ S21\(ς\[❝x❞:=2\]\)$
9-
^\(\d+\) ∀ ς : state \. S21\(ς\) ⇒ \(ς\(❝x❞\) = 1\)$
6+
^\(\d+\) ∀ ς : state \. S13\(ς\) ⇒ S14\(ς\[❝x❞:=0\]\)$
7+
^\(\d+\) ∀ ς : state \. S16\(ς\) ⇒ S17\(ς\[❝x❞:=1\]\)$
8+
^\(\d+\) ∀ ς : state \. S17\(ς\) ⇒ S18\(ς\[❝x❞:=2\]\)$
9+
^\(\d+\) ∀ ς : state \. S18\(ς\) ⇒ \(ς\(❝x❞\) = 1\)$
1010
^\[main\.assertion\.1\] line \d+ property 1: REFUTED$
1111
--

0 commit comments

Comments
 (0)