Skip to content

Commit 3880b98

Browse files
author
Nathan Wetzler
committed
Populate function name in source locations for function contracts
Added function to C type-checking class that will recursively set the function name in source locations of function contract declaration expressions. Previously, function contract declarations would not store an associated function name in the source location because the function name was not known during parsing. CBMC Viewer reports a failure when analyzing the incomplete coverage report, causing the CMBC Starter Kit to fail during a standard build. Also removed source location from "end function" command during contract checking and added proper source location to function contract instrumentation. Resolves issue #7032
1 parent 6766bc4 commit 3880b98

File tree

35 files changed

+69
-42
lines changed

35 files changed

+69
-42
lines changed

regression/contracts/assigns_repeated_ignored/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
main.c
33
--enforce-contract foo
4-
^Ignored duplicate expression '\*x' in assigns clause spec at file main.c line \d+$
4+
^Ignored duplicate expression '\*x' in assigns clause spec at file main.c line \d+ function .*$
55
^EXIT=0$
66
^SIGNAL=0$
77
^VERIFICATION SUCCESSFUL$

regression/contracts/assigns_validity_pointer_02/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ main.c
33
--enforce-contract foo
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\[postcondition.\d+\] file main.c line \d+ Check ensures clause: SUCCESS$
6+
^\[foo.postcondition.\d+\] line \d+ Check ensures clause: SUCCESS$
77
^\[bar.assigns.\d+\] line \d+ Check that \*x is assignable: SUCCESS$
88
^\[bar.assigns.\d+\] line \d+ Check that \*y is assignable: SUCCESS$
99
^\[baz.assigns.\d+\] line \d+ Check that \*z is assignable: SUCCESS$

regression/contracts/contracts_with_function_pointers/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ main.c
33
--enforce-contract bar
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\[postcondition.\d+\] file main.c line \d+ Check ensures clause: SUCCESS$
6+
^\[bar.postcondition.\d+\] line \d+ Check ensures clause: SUCCESS$
77
^\[bar.assigns.\d+\] line \d+ Check that \*return\_value\_baz is assignable: SUCCESS$
88
^\[foo.assigns.\d+\] line \d+ Check that \*y is assignable: SUCCESS$
99
^VERIFICATION SUCCESSFUL$

regression/contracts/function-calls-05/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ main.c
33
--enforce-contract foo
44
^EXIT=0$
55
^SIGNAL=0$
6-
\[postcondition.\d+\] file main.c line \d+ Check ensures clause: SUCCESS
6+
\[foo.postcondition.\d+\] line \d+ Check ensures clause: SUCCESS
77
\[main.assertion.\d+\] line \d+ assertion foo\(\&x, \&y\) \=\= 10: SUCCESS
88
^VERIFICATION SUCCESSFUL$
99
--

regression/contracts/history-pointer-enforce-09/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ main.c
33
--enforce-contract foo
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\[postcondition.\d+\] file main.c line \d+ Check ensures clause: SUCCESS$
6+
^\[foo.postcondition.\d+\] line \d+ Check ensures clause: SUCCESS$
77
^\[foo.assigns.\d+\] line \d+ Check that p->y is assignable: SUCCESS$
88
^VERIFICATION SUCCESSFUL$
99
--

regression/contracts/history-pointer-enforce-10/test.desc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ main.c
33
--enforce-contract foo --enforce-contract bar --enforce-contract baz
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\[postcondition.\d+\] file main.c line \d+ Check ensures clause: SUCCESS$
7-
^\[postcondition.\d+\] file main.c line \d+ Check ensures clause: SUCCESS$
8-
^\[postcondition.\d+\] file main.c line \d+ Check ensures clause: SUCCESS$
6+
^\[bar.postcondition.\d+\] line \d+ Check ensures clause: SUCCESS$
7+
^\[baz.postcondition.\d+\] line \d+ Check ensures clause: SUCCESS$
8+
^\[foo.postcondition.\d+\] line \d+ Check ensures clause: SUCCESS$
99
^\[bar.assigns.\d+\] line \d+ Check that p->y is assignable: SUCCESS$
1010
^\[foo.assigns.\d+\] line \d+ Check that \*p->y is assignable: SUCCESS$
1111
^\[foo.assigns.\d+\] line \d+ Check that z is assignable: SUCCESS$

regression/contracts/history-pointer-replace-01/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ main.c
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$
77
ASSERT \*\(address_of.*n.*\) > 0
8-
ASSUME \*\(address_of.*n.*\) = tmp_cc[\$\d]? \+ 2
8+
ASSUME \*\(address_of.*n.*\) = .*tmp_cc[\$\d]? \+ 2
99
--
1010
--
1111
Verification:

regression/contracts/history-pointer-replace-02/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ main.c
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$
77
ASSERT \*\(address_of.*n.*\) = 0
8-
ASSUME \*\(address_of.*n.*\) ≥ tmp_cc[\$\d]? \+ 2
8+
ASSUME \*\(address_of.*n.*\) ≥ .*tmp_cc[\$\d]? \+ 2
99
--
1010
--
1111
Verification:

regression/contracts/history-pointer-replace-04/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ main.c
33
--replace-call-with-contract foo
44
^EXIT=10$
55
^SIGNAL=0$
6-
^\[precondition.\d+\] file main.c line \d+ Check requires clause: SUCCESS$
6+
^\[foo.precondition.\d+\] line \d+ Check requires clause: SUCCESS$
77
^\[main.assertion.\d+\] line \d+ assertion p->y \!\= 7: FAILURE$
88
^VERIFICATION FAILED$
99
--

regression/contracts/quantifiers-exists-both-enforce/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ main.c
33
--enforce-contract f1
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\[postcondition.\d+\] file main.c line \d+ Check ensures clause: SUCCESS$
6+
^\[f1.postcondition.\d+\] line \d+ Check ensures clause: SUCCESS$
77
^VERIFICATION SUCCESSFUL$
88
--
99
^warning: ignoring

0 commit comments

Comments
 (0)