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] Frama-C: Detecting unreachable code?
- Subject: [Frama-c-discuss] Frama-C: Detecting unreachable code?
- From: Dillon.Pariente at dassault-aviation.com (Pariente Dillon)
- Date: Thu, 23 Jan 2014 09:02:37 +0000
- In-reply-to: <52E0D85C.3060504@cea.fr>
- References: <B517F47C2F6D914AA8121201F9EBEE6701C7660449A7@Mail1.FCMD.local> <52E0C26F.2000605@linux-france.org> <20140123082550.GA7256@opentech.at> <CAOH62JhyfqOmKmw5iKjx1CSifK2X6ajxZBxd--h4_nK-3OxmrA@mail.gmail.com> <52E0D85C.3060504@cea.fr>
Hi, You could also try this: int main(int i) { if (0 <= i && i <= 10) { return -1; } if (i == 5) { //@ assert \false; return -2; } return 0; } Analyzed by: frama-c-gui -val -wp foo.c __retres IN {-1; 0} For sure, it requires a manual annotation, but in some cases, when it is not affordable to use higher -slevel, it may help. D. De : frama-c-discuss-bounces at lists.gforge.inria.fr [mailto:frama-c-discuss-bounces at lists.gforge.inria.fr] De la part de Nicky Williams Envoy? : jeudi 23 janvier 2014 09:53 ? : Frama-C public discussion Objet : Re: [Frama-c-discuss] Frama-C: Detecting unreachable code? Of course, static analysis can only detect unreachable code. To be sure that THERE IS NO unreachable code you need to do path testing, eg. with the pathcrawler plugin (and to achieve full coverage with no timeouts). Nicky Williams On 23/01/2014 09:36, Pascal Cuoq wrote: On Thu, Jan 23, 2014 at 9:25 AM, Nicholas Mc Guire <der.herr at hofr.at<mailto:der.herr at hofr.at>> wrote: On Thu, 23 Jan 2014, David MENTRE wrote: just for completenes here is the code used in the above runs: int main(int i) { if (0 <= i && i <= 10) { return -1; } if (i == 5) { /* can never reach here? */ return -2; } return 0; } Use option -slevel 20 -val in order for Frama-C's value analysis to separate the execution paths where 0 > i, 0 <= i, ...: $ frama-c -val -slevel 20 t.c ... [value] ====== VALUES COMPUTED ====== [value] Values at end of function main: __retres ? {-1; 0} There is only one value analysis option to know until you are an advanced user, and it is this one. It is the first and only non-administrative option used in the tutorial of the value analysis. _______________________________________________ Frama-c-discuss mailing list Frama-c-discuss at lists.gforge.inria.fr<mailto:Frama-c-discuss at lists.gforge.inria.fr> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/frama-c-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20140123/a6a93b49/attachment-0001.html>
- References:
- [Frama-c-discuss] Frama-C: Detecting unreachable code?
- From: dganesan at fc-md.umd.edu (Dharmalingam Ganesan)
- [Frama-c-discuss] Frama-C: Detecting unreachable code?
- From: dmentre at linux-france.org (David MENTRE)
- [Frama-c-discuss] Frama-C: Detecting unreachable code?
- From: der.herr at hofr.at (Nicholas Mc Guire)
- [Frama-c-discuss] Frama-C: Detecting unreachable code?
- From: pascal.cuoq at gmail.com (Pascal Cuoq)
- [Frama-c-discuss] Frama-C: Detecting unreachable code?
- From: nicky.williams at cea.fr (Nicky Williams)
- [Frama-c-discuss] Frama-C: Detecting unreachable code?
- Prev by Date: [Frama-c-discuss] [PROVENANCE INTERNET] Re: Frama-C: Detecting unreachable code?
- Next by Date: [Frama-c-discuss] Frama-C: Detecting unreachable code?
- Previous by thread: [Frama-c-discuss] Frama-C: Detecting unreachable code?
- Next by thread: [Frama-c-discuss] Frama-C: Detecting unreachable code?
- Index(es):