Skip to content

Commit a7bfc10

Browse files
authored
Merge pull request #6234 from feliperodri/clean-up-contracts
Refactoring code contracts implementation
2 parents 06c563a + 5d0ffe0 commit a7bfc10

File tree

14 files changed

+1035
-1373
lines changed

14 files changed

+1035
-1373
lines changed

CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
/src/goto-analyzer/ @martin-cs @chrisr-diffblue @peterschrammel
4646
/src/goto-harness/ @martin-cs @chrisr-diffblue @peterschrammel
4747
/src/goto-instrument/ @martin-cs @chrisr-diffblue @peterschrammel
48-
/src/goto-instrument/code_contracts.* @tautschnig @feliperodri @SaswatPadhi
49-
doc/cprover-manual/contracts* @tautschnig @feliperodri @SaswatPadhi
48+
/src/goto-instrument/contracts/ @tautschnig @feliperodri @SaswatPadhi
49+
/doc/cprover-manual/contracts* @tautschnig @feliperodri @SaswatPadhi
5050
/src/goto-diff/ @tautschnig @peterschrammel
5151
/src/jsil/ @kroening @tautschnig
5252
/src/memory-analyzer/ @tautschnig @chrisr-diffblue

regression/contracts/assigns_replace_06/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
CORE
22
main.c
33
--replace-all-calls-with-contracts
4-
^EXIT=0$
4+
^EXIT=10$
55
^SIGNAL=0$
6-
^VERIFICATION SUCCESSFUL$
6+
^VERIFICATION FAILED$
77
--
88
--
99
Checks whether the values outside the array range specified by the assigns

regression/contracts/assigns_type_checking_valid_cases/main.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
int *x;
44
int y;
55

6+
struct blob
7+
{
8+
int allocated;
9+
};
610
struct buf
711
{
812
int *data;
913
size_t len;
14+
struct blob aux;
1015
};
1116

1217
void foo1(int a) __CPROVER_assigns(a)
@@ -76,9 +81,10 @@ void foo9(int array[]) __CPROVER_assigns(array)
7681
}
7782

7883
void foo10(struct buf *buffer) __CPROVER_requires(buffer != NULL)
79-
__CPROVER_assigns(*buffer)
84+
__CPROVER_assigns(buffer->len, buffer->aux.allocated)
8085
{
8186
buffer->len = 0;
87+
buffer->aux.allocated = 0;
8288
}
8389

8490
int main()

src/ansi-c/ansi_c_convert_type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ void ansi_c_convert_typet::read_rec(const typet &type)
257257
{
258258
if(
259259
operand.id() != ID_symbol && operand.id() != ID_ptrmember &&
260-
operand.id() != ID_dereference)
260+
operand.id() != ID_member && operand.id() != ID_dereference)
261261
{
262262
error().source_location = source_location;
263263
error() << "illegal target in assigns clause" << eom;

src/goto-instrument/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ SRC = accelerate/accelerate.cpp \
1616
alignment_checks.cpp \
1717
branch.cpp \
1818
call_sequences.cpp \
19-
code_contracts.cpp \
19+
contracts/assigns.cpp \
20+
contracts/memory_predicates.cpp \
21+
contracts/contracts.cpp \
2022
concurrency.cpp \
2123
count_eloc.cpp \
2224
cover.cpp \

0 commit comments

Comments
 (0)