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] [jessie-plugin] cannot be used on your code

  • Subject: [Frama-c-discuss] [jessie-plugin] cannot be used on your code
  • From: pascal.cuoq at (Pascal Cuoq)
  • Date: Fri, 18 May 2012 07:02:09 +0200
  • In-reply-to: <>
  • References: <> <>

On Thu, May 17, 2012 at 6:02 PM, dams <damien.balima at> wrote:

> ? ?/*@
> ? ? ?@ loop invariant max_id > i;
> ? ? ?@ loop variant max_id-i;
> ? ? ?@*/
> ? ?while(i<max_id){

Another issue is that the invariant you have written,
which is supposed holds at each iteration by definition,
implies that the loop condition is always true, which would
mean that the loop does not terminate.

The correct invariant for i of your loop is i <= max_id.
This invariant is true up to the last iteration, when the
loop exits.
When the loop is exited, Jessie knows that the loop invariant
holds (i <= max_id) and that the condition (i < max_id) is false.
It can then infer that i == max_id for the rest of the program,
in case the program uses i after the loop.

In summary, a loop invariant that implies the loop condition
is a wrong loop invariant, unless the loop is an infinite loop.