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] two-dimensional array requires clause
- Subject: [Frama-c-discuss] two-dimensional array requires clause
- From: dmentre at linux-france.org (David MENTRE)
- Date: Tue, 28 Jan 2014 10:17:07 +0100
- In-reply-to: <CAOGRM5YibT7SzfRWcpVfwxWP-555z633xGDU7Lh0Wmj3481rig@mail.gmail.com>
- References: <CAOGRM5YibT7SzfRWcpVfwxWP-555z633xGDU7Lh0Wmj3481rig@mail.gmail.com>
Hello, Le 28/01/2014 00:39, Dragan a ?crit : > I'd like to know how to I write requires clause for two-dimensional arrays. I would write it like that: --------------------- /*@ requires \forall integer i; 0 <= i < n ==> (\forall integer j; 0 <= j < n ==> (\valid(&a[i][j]) && a[i][j] >= 0)); // or requires \valid(&(a[0..n-1][0..n-1])); requires n == 5; */ void f(int a[5][5], int n) { a[4][4] = 1; } void main(void) { int a[5][5] = { {0, }, }; f(a, 5); } --------------------- "frama-c-gui -wp -wp-rte 2d_req.c" proves all predicates but the RTE assert on "a[4][4] = 1" (why?). "frama-c-gui -val -slevel 100 2d_req.c" proves all but the quantified predicate in f()'s contract (but this is expected). > Is there is some new function similar to \valid()? "\valid(&(a[0..n-1][0..n-1]))"? Best regards, david
- References:
- [Frama-c-discuss] two-dimensional array requires clause
- From: dragan.stosic at gmail.com (Dragan)
- [Frama-c-discuss] two-dimensional array requires clause
- Prev by Date: [Frama-c-discuss] A significant case study using Frama-C
- Next by Date: [Frama-c-discuss] two-dimensional array requires clause
- Previous by thread: [Frama-c-discuss] two-dimensional array requires clause
- Next by thread: [Frama-c-discuss] two-dimensional array requires clause
- Index(es):