Is there a way to enforce the assumptions made by a WP memory model?
Consider the following two functions to be verified with Frama-C:
/*@ requires \valid(a) && \valid(b);
@ ensures A: *a == 1;
@ ensures B: *b == 2;
@ assigns *a, *b;
@*/
void assign_many(int *a, int *b)
{
*a = 1;
*b = 2;
}
int main() {
int a = 42;
assign_many(&a, &a);
//@ assert a == 1;
//@ assert a == 2;
return 0;
}
The function assign_many cannot verify in the general case, since the two arguments could alias (as demonstrated in main). However, if you choose the Hoare+ref memory model, this function verifies since it assumes separation. But I can still verify main, even using the Typed memory model. With the command-line option -wp-warn-memory-model, a message warns you about what assumptions the memory model requires. Is it possible to enforce these assumptions, e.g., add them as preconditions to assign_many?