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] New Version of "ACSL by Example" for Frama-C Fluorine


  • Subject: [Frama-c-discuss] New Version of "ACSL by Example" for Frama-C Fluorine
  • From: jens.gerlach at fokus.fraunhofer.de (Gerlach, Jens)
  • Date: Mon, 16 Dec 2013 11:01:03 +0000
  • In-reply-to: <mailman.39308.1387188705.1111.frama-c-discuss@lists.gforge.inria.fr>
  • References: <mailman.39308.1387188705.1111.frama-c-discuss@lists.gforge.inria.fr>

Hello Pascal and Lo?c,

thanks for discussing the additional ensures clauses of swap.
The main reason I added them is related to an incertitude I have about \valid and free.

Imagine I have a function foo with the following contract that is verified by WP.

/*@
    requires \valid(a);
    assigns \nothing;
    ensures \result == *a;
*/
int foo(int* a)
{
    return *a;
}

But what if someone provides the following implementation

int foo(int* a)
{
    int tmp = *a;
    free(a);
    return tmp;
}

Wouldn?t this implementation also satisfy the contract BUT invalidating the pointer a?
Adding the clause ?ensures \valid(a);? would in my opinion exclude the second implementation. 

Jens