Open
Description
Dear CBMC Developers,
Thank you for your outstanding work on CBMC, which has been invaluable for my verification efforts. I am writing to ask a question on a parsing error I encountered when using __CPROVER_loop_invariant
in a simple C program with CBMC 6.4.1 running inside a cbmc Docker container. I would greatly appreciate your guidance:
Code (loop_invariant2.c
)
int sum_array(int arr[], int n) {
int result = 0;
for (int i = 0; i < n; i++) {
__CPROVER_loop_invariant(i >= 0 && i <= n); // Invariant: i is within array bounds
result += arr[i];
}
return result;
}
CBMC Commands and Output
I executed the following command inside the Docker container:
cbmc loop_invariant2.c --function sum_array
Output:
CBMC version 6.4.1 (n/a) 64-bit x86_64 linux
file loop_invariant2.c line 7 function sum_array: syntax error before '__CPROVER_loop_invariant'
PARSING ERROR
I guess we need to use some special CBMC options so that __CPROVER_loop_invariant
can be recognized by CBMC? Thank you for your guidance.
Metadata
Metadata
Assignees
Labels
No labels