-
Notifications
You must be signed in to change notification settings - Fork 79
Closed
Labels
subsystem: crucible-llvmIssues related to LLVM bitcode verification with crucible-llvmIssues related to LLVM bitcode verification with crucible-llvmtype: questionIssues that are primarily asking questionsIssues that are primarily asking questionstype: supportIssues that are primarily support requestsIssues that are primarily support requests
Description
I'm really struggling to specify an array of arrays in saw
Consider the following example. How can I (for a given nNumElements and nLength) prove that clear zeroes out each pList?
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
typedef struct mytype {
uint32_t nLength;
uint32_t *pList;
} mytype;
mytype *init(uint32_t nNumElements, uint32_t nLength) {
mytype *ret = malloc(nNumElements * sizeof(mytype));
uint32_t i;
for(i = 0; i < nNumElements; i++) {
ret[i].nLength = nLength;
ret[i].pList = malloc(nLength * sizeof(uint32_t));
}
return ret;
}
void clear(mytype *x, uint32_t nNumElements) {
uint32_t i, j;
for(i = 0; i < nNumElements; i++) {
for(j = 0; j < x[i].nLength; i++) {
x[i].pList[j] = 0;
}
}
}
Using the generic function below, I am able to create a list of the structures, but I can't figure out how to transform this list to an array.
rec struct_list numElements init_function params =
if (eval_bool {{ (`numElements : [32]) == 0 }}) then []
else (concat [init_function params]
(struct_list (eval_int {{ (`numElements : [32]) - 1 }}) init_function params));
I have tried running the result of this function through crucible_array, but get type mismatches between SetupValue and CrucibleSetup...so, I'm lost right now. Any help would be appreciated.
Metadata
Metadata
Assignees
Labels
subsystem: crucible-llvmIssues related to LLVM bitcode verification with crucible-llvmIssues related to LLVM bitcode verification with crucible-llvmtype: questionIssues that are primarily asking questionsIssues that are primarily asking questionstype: supportIssues that are primarily support requestsIssues that are primarily support requests