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] Use of Jessie and Value Analysis plug-in
- Subject: [Frama-c-discuss] Use of Jessie and Value Analysis plug-in
- From: guillaume.melquiond at inria.fr (Guillaume Melquiond)
- Date: Sat, 20 Aug 2011 15:27:39 +0200
- In-reply-to: <CAEtoXR2kJR62bckCpVuvLD8RGyPFaECgEjhcX06GeTSnP6RF_Q@mail.gmail.com>
- References: <CAEtoXR2yzkk9sKSa4gy+7hAAQwWNZAZGXDQe+5Py94BS1tcLog@mail.gmail.com> <1313705735.1903.6.camel@guillaume-laptop> <CAEtoXR2kJR62bckCpVuvLD8RGyPFaECgEjhcX06GeTSnP6RF_Q@mail.gmail.com>
Le vendredi 19 ao?t 2011 ? 19:00 -0300, Rovedy Aparecida Busquim e Silva a ?crit : > 1) Sorry for my mistake. I am sending the function with the new > annotations (2 versions) but the VCs related with ensures > clauses aren't proved. > > /*@ assigns \nothing; > @*/ > extern double fabs(double) ; > > #define LIMIT 6.111111e-2 > > #pragma JessieFloatModel(defensive) > > /*@ requires \valid(AB_Ptr) && \valid(CD_Ptr); > @ assigns *AB_Ptr, *CD_Ptr; > @ ensures -6.111111e-2 <= *AB_Ptr <= 6.111111e-2; > @ ensures -6.111111e-2 <= *CD_Ptr <= 6.111111e-2; > @ */ This is not sufficient to prove your function. In particular, fabs is underspecified. If I were to plug into your program an fabs function that returns a value smaller than the absolute value, then your limitValue would obviously return values that are invalid with respect to your postcondition. So you should at least change the specification of fabs to /*@ assigns \nothing; @ ensures \result == \abs(x); @*/ extern double fabs(double x); Even then, your limitValue function would still return broken values. This is due to 6.111111e-2 not being exactly representable as a floating-point value. And to make it worse, most (if not all) compilers will choose to replace it by the floating-point number just above. As a consequence, if you pass 6.111111e-2 (as a floating-point value) to your function, it will return a value greater than 6.111111e-2 (as a real number). So you have to account for this in your program (or in your specification). Once you have done so, your program is finally correct and you can start proving it. Unfortunately, I don't know of any automatic tool that can prove the correctness of this kind of C code without some human help. (I would be glad to be proven wrong though.) Best regards, Guillaume
- References:
- [Frama-c-discuss] Use of Jessie and Value Analysis plug-in
- From: rovedy at ig.com.br (Rovedy Aparecida Busquim e Silva)
- [Frama-c-discuss] Use of Jessie and Value Analysis plug-in
- From: guillaume.melquiond at inria.fr (Guillaume Melquiond)
- [Frama-c-discuss] Use of Jessie and Value Analysis plug-in
- From: rovedy at ig.com.br (Rovedy Aparecida Busquim e Silva)
- [Frama-c-discuss] Use of Jessie and Value Analysis plug-in
- Prev by Date: [Frama-c-discuss] Use of Jessie and Value Analysis plug-in
- Next by Date: [Frama-c-discuss] Simplifying branches
- Previous by thread: [Frama-c-discuss] Use of Jessie and Value Analysis plug-in
- Next by thread: [Frama-c-discuss] Use of Jessie and Value Analysis plug-in
- Index(es):