assigns nothing really false. The variable p is local, but the effect is performed on *p , which is an arbitrary pointer.
Counterexample
If new_value is defined as the following:
int g; int *new_value(){ return &g; }
It satisfies the specification, and g is 8 at the end of the main one.
Go further
If the problem is to enable you to assign the main function without any knowledge of the behavior of the new_value function, you can make the new_value result accessible from the logical space:
For instance:
//@ logic int * R ; //@ ensures \result == R && \valid(R) ; assigns \nothing ; extern int *new_value(); //@ assigns *p; void f(int * p) { β¦ } //@ assigns *R ; int main(void) { β¦ }
A more general solution would be to have a set of pointers for R, and not the only one.
source share