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] Issue with offset in static strings
- Subject: [Frama-c-discuss] [Jessie] Issue with offset in static strings
- From: dmentre at linux-france.org (David MENTRE)
- Date: Tue, 3 Mar 2009 17:52:49 +0100
Hello, In my code, I have a function of following form: /*@ requires rand_fd >= 0; ensures \result >= 'a' && \result <= 'z'; */ static int randletter(int rand_fd) { int tmp = randval(rand_fd, 26); //@ assert tmp >= 0 && tmp <= 26; return "abcdefghijklmnopqrstuvwxyz"[tmp]; } I am able to correctly prove the "assert tmp >= 0 && tmp <= 26;" assertion. However, Alt-Ergo is not able to prove the randletter() postcondition. I assume this is because some steps are missing between the assertion and the postcondition. Any idea of what should I provide? I have attempted following code, with no luck: /*@ requires rand_fd >= 0; ensures \result >= 'a' && \result <= 'z'; */ static int randletter(int rand_fd) { char str[] = "abcdefghijklmnopqrstuvwxyz"; int tmp = randval(rand_fd, 26); //@ assert tmp >= 0 && tmp <= 26; //@ assert str[0] == 'a'; return str[tmp]; } Alt-Ergo fails to prove "assert str[0] == 'a';". Is it because Frama-C / Jessie do not "look into" "str"? Sincerely yours, d. PS : The C code is the same as in my previous email regarding another issue with Jessie.
- Prev by Date: [Frama-c-discuss] [Jessie] Issue with behavior in contracts
- Next by Date: [Frama-c-discuss] [Jessie] Issue with behavior in contracts
- Previous by thread: [Frama-c-discuss] [Jessie] Issue with behavior in contracts
- Next by thread: [Frama-c-discuss] extracting information from jessie-gui
- Index(es):