int main() { unsigned n = nondet_unsigned(); __CPROVER_assume(n>0); unsigned pA[n]; unsigned *p = (unsigned *)malloc(sizeof(unsigned) * n); for (int i=0; i<n; i++) { p[i] = i; pA[i] = i; } assert(p[n-1] == n-1); assert(pA[n-1] == n-1); assert(0); return 0; }
void init_program_cbmc(opcode_t program[], Unsigned program_size) { for (Unsigned i = 0; i < program_size; ++i) { program[i] = nondet_unsigned(); opcode_t opcode = program[i]; __CPROVER_assume( opcode == OPC_NOP || opcode == OPC_FALSE || opcode == OPC_TRUE || opcode == OPC_NOT || opcode == OPC_AND || opcode == OPC_OR || opcode == OPC_NAND || opcode == OPC_XOR || opcode == OPC_COPY1 || opcode == OPC_COPY2 || opcode == OPC_COPY3 || opcode == OPC_COPY4 || opcode == OPC_COPY5 || opcode == OPC_COPY6 || opcode == OPC_COPY7 || opcode == OPC_COPY8 || opcode == OPC_COPY9); //__CPROVER_assume(opcode != OPC_TRUE); //__CPROVER_assume(opcode != OPC_FALSE); //__CPROVER_assume(opcode != OPC_NOT); //__CPROVER_assume(opcode != OPC_AND); //__CPROVER_assume(opcode != OPC_OR); //program[i] = opcode; } }
void main() { //******************************************************* // Total Paths = 19, Feasible Path=3, Infeasible Path=16 // ****************************************************** unsigned int m,n; // Structures are passed as function arguments to build the harness struct state_element_f stf; struct state_element_g stg; //__CPROVER_assume(0); // Identify and bind equivalent signals in both design to allow partitioning /*if(nondet_bool()) { m=1; n=1; } else if(nondet_bool()) { m=2; n=2; } else if(nondet_bool()) { m=3; n=3; } else { __CPROVER_assume(m==n); }*/ // __CPROVER_assume(m==n); m=nondet_unsigned(); n=f(m,stf); //n=m; g(n,stg); assert(1); //**************************************************** //***************************************************** // Total Paths = 16, Feasible Path=16, Infeasible Path=0 // **************************************************** /*unsigned int m; // Structures are passed as function arguments to build the harness struct state_element_f stf; struct state_element_g stg; f(m,stf); g(m,stg); assert(1);*/ //**************************************************** //***************************************************************************** // When the last else of g() contains the extra code of if-else statement, then // Total Paths = 44, Feasible Path=1, Infeasible Path=43 // **************************************************************************** /*unsigned int m; // Structures are passed as function arguments to build the harness struct state_element_f stf; struct state_element_g stg; // Identify and bind equivalent signals in both design to allow partitioning __CPROVER_assume(stf.x == 1 && stg.y == 1); f(m,stf); g(m,stg); assert(1);*/ //**************************************************** }