--- layout: fc_discuss_archives title: Message 41 from Frama-C-discuss on December 2008 ---
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] \result in assigns




In principle you should write

   assigns  dest[0..\at(\result,Post)]

because by default, assigns clauses are related to the pre-state.

BUT, I'm afraid that this feature is not yet implemented in the Jessie 
plugin, which is what you probably want...

The only workaround I see for the moment is to give an over-approximated 
assigns clause and a ensures clauses saying explicitly that cells for 
indexes outside that range did not change:

/*@ assigns dest[..]
   @ ensures
   @ \forall integer k;
   @    ! ( 0 <= k <= \result) ==> dest[k] == \old(dest[k]);
   @*/

- Claude

Christoph Weber wrote:
> Hello again,
> 
> I need to use \result in an assigns - clause.
> 
> The algorithm 
> int remove_copy_array (int* a, int length, int* dest, int value );
> 
> copies elements that are not equal to value from the range a[0, length) to a range beginning at dest. The return value is the length of the resulting range. This operation is stable, meaning that the relative order of the elements that are copied is the same as in the range a[0, length).
> 
> To proof that only dest[0..\result] has been altered, i need \result
> 
> Unfortunately i get the message:
> 
> File "remove_copy_array.jc", line 333, characters 22-29: typing error: \result not allowed here
> 
> Cheers
> 
> 
> 
> Christoph
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Frama-c-discuss mailing list
> Frama-c-discuss at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/frama-c-discuss

-- 
Claude March?                          | tel: +33 1 72 92 59 69
INRIA Saclay - ?le-de-France           | mobile: +33 6 33 14 57 93
Parc Orsay Universit?                  | fax: +33 1 74 85 42 29
4, rue Jacques Monod - B?timent N      | http://www.lri.fr/~marche/
F-91893 ORSAY Cedex                    |