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] arrays in struct
- Subject: [Frama-c-discuss] arrays in struct
- From: hollas at informatik.htw-dresden.de (Boris Hollas)
- Date: Mon, 15 Nov 2010 16:08:49 +0100
- In-reply-to: <EFF6534C8F2FC940A9D7929433E12D4E216F7A@TITAN.first.fraunhofer.de>
- References: <EFF6534C8F2FC940A9D7929433E12D4E216F7A@TITAN.first.fraunhofer.de>
On Fri, 2010-11-12 at 13:54 +0100, Jens Gerlach wrote: > I want to write a simple get-function for a struct that contains a > fixed-size array. > It seems, however, that Frama-C (or Jessie?) does not recognise that the > array is a valid range. > Did I forget something obvious, is it a known bug, or should I create an > entry to the BTS? > > Regards > > Jens > > > struct S > { > int array[3]; > }; > > typedef struct S S; > > /*@ > requires \valid(s); > requires 0 <= i < 3; > > assigns \nothing; > > ensures \result == s->array[i]; > */ > int get(S* s, int i) > { > //@ assert \valid_range(s->array, 0, 2); > return s->array[i]; > } Does requires \valid(s) && \valid(s->array+(0..2)); work? Each time a structure s of type S is created, the member int array[3] is also created. Therefore, the validity of s should imply the validity of s->array+(0..2). If Jessie doesn't recognized this, it's a bug. -- Regards, Boris
- Follow-Ups:
- [Frama-c-discuss] arrays in struct
- From: jens.gerlach at first.fraunhofer.de (Jens Gerlach)
- [Frama-c-discuss] arrays in struct
- References:
- [Frama-c-discuss] arrays in struct
- From: jens.gerlach at first.fraunhofer.de (Jens Gerlach)
- [Frama-c-discuss] arrays in struct
- Prev by Date: [Frama-c-discuss] \at in ACSL assertions
- Next by Date: [Frama-c-discuss] \at in ACSL assertions
- Previous by thread: [Frama-c-discuss] arrays in struct
- Next by thread: [Frama-c-discuss] arrays in struct
- Index(es):