Redefintion of variables in same scope is allowed in annotations
ID0002125: This issue was created automatically from Mantis Issue 2125. Further discussion may take place here.
|ID0002125||Frama-C||Kernel > ACSL implementation||public||2015-06-01||2015-06-02|
|Product Version||Frama-C Neon-20140301||Target Version||-||Fixed in Version||-|
Consider an example:
/@ predicate is_valid(int n, int n) = (0 <= n) ; */
Frama-C doesn't throw any exception for the above predicate, even though variable "n" is defined twice in the same scope and it uses n as of Type int and allows comparison 0 <= n.
If I change the above predicate to following: /@ predicate is_valid_int_range(int n, int n) = (0 <= n) ; / Frama-c complains "[kernel] user error: comparison of incompatible types: ℤ and int * in annotation" for comparison 0 <= n in above example, which means that it treats n of type int.
Similarly, redefinition of variable in same scope is allowed in quantifier expressions like: loop invariant \forall int k, char k; 0 <= k && k< i ==> a[k] == b[k];
In C language it is not allowed to redefine variable in same scope. Is this an intentional behavior? And if so that is the purpose behind it? I don't see this matter is discussed in ACSL document.