|
| 1 | +int nondet_int(); |
| 2 | +void foo( |
| 3 | + int *in, |
| 4 | + int *in1, |
| 5 | + int *in2, |
| 6 | + int *in3, |
| 7 | + int *in4, |
| 8 | + int *in5, |
| 9 | + int *in6, |
| 10 | + int **out1, |
| 11 | + int **out2, |
| 12 | + int **out3, |
| 13 | + int **out4, |
| 14 | + int **out5, |
| 15 | + int **out6) |
| 16 | + // clang-format off |
| 17 | +__CPROVER_requires(__CPROVER_is_fresh(in, sizeof(int))) |
| 18 | +__CPROVER_requires(__CPROVER_is_fresh(in1, sizeof(int)) && __CPROVER_pointer_in_range_dfcc(in, in1, in)) |
| 19 | +__CPROVER_requires(__CPROVER_pointer_in_range_dfcc(in, in2, in) && __CPROVER_is_fresh(in2, sizeof(int))) |
| 20 | +__CPROVER_requires(__CPROVER_is_fresh(in3, sizeof(int)) && __CPROVER_pointer_equals(in3, in)) |
| 21 | +__CPROVER_requires(__CPROVER_pointer_equals(in4, in) && __CPROVER_is_fresh(in4, sizeof(int))) |
| 22 | +__CPROVER_requires(__CPROVER_pointer_in_range_dfcc(in, in5, in) && __CPROVER_pointer_equals(in5, in)) |
| 23 | +__CPROVER_requires(__CPROVER_pointer_equals(in6, in) && __CPROVER_pointer_in_range_dfcc(in, in6, in)) |
| 24 | +__CPROVER_requires(__CPROVER_is_fresh(out1, sizeof(int *))) |
| 25 | +__CPROVER_requires(__CPROVER_is_fresh(out2, sizeof(int *))) |
| 26 | +__CPROVER_requires(__CPROVER_is_fresh(out3, sizeof(int *))) |
| 27 | +__CPROVER_requires(__CPROVER_is_fresh(out4, sizeof(int *))) |
| 28 | +__CPROVER_requires(__CPROVER_is_fresh(out5, sizeof(int *))) |
| 29 | +__CPROVER_requires(__CPROVER_is_fresh(out6, sizeof(int *))) |
| 30 | +__CPROVER_assigns(*out1, *out2, *out3, *out4, *out5, *out6) |
| 31 | +__CPROVER_ensures(__CPROVER_is_fresh(*out1, sizeof(int)) && __CPROVER_pointer_in_range_dfcc(in, *out1, in)) |
| 32 | +__CPROVER_ensures(__CPROVER_pointer_in_range_dfcc(in, *out2, in) && __CPROVER_is_fresh(*out2, sizeof(int))) |
| 33 | +__CPROVER_ensures(__CPROVER_is_fresh(*out3, sizeof(int)) && __CPROVER_pointer_equals(*out3, in)) |
| 34 | +__CPROVER_ensures(__CPROVER_pointer_equals(*out4, in) && __CPROVER_is_fresh(*out4, sizeof(int))) |
| 35 | +__CPROVER_ensures(__CPROVER_pointer_in_range_dfcc(in, *out5, in) && __CPROVER_pointer_equals(*out5, in)) |
| 36 | +__CPROVER_ensures(__CPROVER_pointer_equals(*out6, in) && __CPROVER_pointer_in_range_dfcc(in, *out6, in)) |
| 37 | +// clang-format on |
| 38 | +{ |
| 39 | + int *tmp1 = malloc(sizeof(int)); |
| 40 | + __CPROVER_assume(tmp1); |
| 41 | + *out1 = nondet_int() ? tmp1 : in; |
| 42 | + |
| 43 | + int *tmp2 = malloc(sizeof(int)); |
| 44 | + __CPROVER_assume(tmp2); |
| 45 | + *out2 = nondet_int() ? tmp2 : in; |
| 46 | + |
| 47 | + int *tmp3 = malloc(sizeof(int)); |
| 48 | + __CPROVER_assume(tmp3); |
| 49 | + *out3 = nondet_int() ? tmp3 : in; |
| 50 | + |
| 51 | + int *tmp4 = malloc(sizeof(int)); |
| 52 | + __CPROVER_assume(tmp4); |
| 53 | + *out4 = nondet_int() ? tmp4 : in; |
| 54 | + |
| 55 | + *out5 = in; |
| 56 | + |
| 57 | + *out6 = in; |
| 58 | +} |
| 59 | + |
| 60 | +int main() |
| 61 | +{ |
| 62 | + int *in, *in1, *in2, *in3, *in4, *in5, *in6; |
| 63 | + int **out1, **out2, **out3, **out4, **out5, **out6; |
| 64 | + foo(in, in1, in2, in3, in4, in5, in6, out1, out2, out3, out4, out5, out6); |
| 65 | + return 0; |
| 66 | +} |
0 commit comments