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: virgile.prevosto at m4x.org (Virgile Prevosto)
- Date: Mon, 16 Dec 2013 22:46:14 +0100
- In-reply-to: <6B28C11E-82FB-4D16-8F3A-903069243B46@fokus.fraunhofer.de>
- References: <mailman.39308.1387188705.1111.frama-c-discuss@lists.gforge.inria.fr> <6B28C11E-82FB-4D16-8F3A-903069243B46@fokus.fraunhofer.de>
Hello Jens, Le lun. 16 d?c. 2013 11:01:03 CET, "Gerlach, Jens" <jens.gerlach at fokus.fraunhofer.de> a ?crit : > /*@ > requires \valid(a); > assigns \nothing; > ensures \result == *a; > */ > int foo(int* 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 No, it won't satisfy the contract. As soon as a is freed, *a can be anything. On the other hand, it would satisfy ensures \result == \old(*a); Another possibility of "strange" behavior would be something like /*@ requires \valid(a); assigns \nothing; ensures \result == a; */ int* foo(int* a) { int tmp = a; free(a); return tmp; } but then, the contract is missing a frees a; clause (which defaults implicitely to frees \nothing; allocates \nothing; meaning that the function should not (de)allocate anything, as is the case for most C functions). Best regards, -- E tutto per oggi, a la prossima volta. Virgile
- References:
- [Frama-c-discuss] New Version of "ACSL by Example" for Frama-C Fluorine
- From: jens.gerlach at fokus.fraunhofer.de (Gerlach, Jens)
- [Frama-c-discuss] New Version of "ACSL by Example" for Frama-C Fluorine
- Prev by Date: [Frama-c-discuss] New Version of "ACSL by Example" for Frama-C Fluorine
- Previous by thread: [Frama-c-discuss] New Version of "ACSL by Example" for Frama-C Fluorine
- Next by thread: [Frama-c-discuss] Is there any difference between "assigns \result \from \nothing" and "assigns \nothing"
- Index(es):