Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] \result in assigns


  • Subject: [Frama-c-discuss] \result in assigns
  • From: Claude.Marche at inria.fr (Claude Marché)
  • Date: Mon, 15 Dec 2008 14:35:10 +0100
  • In-reply-to: <98D7D9B6279F4AF7AEC029B578B73EBC@AHARDPLACE>
  • References: <98D7D9B6279F4AF7AEC029B578B73EBC@AHARDPLACE>


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                    |