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: jens.gerlach at first.fraunhofer.de (Jens Gerlach)
  • Date: Mon, 15 Nov 2010 17:39:40 +0100
  • In-reply-to: <1289833729.1709.36.camel@iti27>

Yes, it works with the additional requires.
I have already submitted an entry to BTS.
Interestingly, all "safety proof obligations" are proven
for the original specification. Thus, it does seem to recognize
that s->array[i] is a valid memory access for 0 <= i < 2 .

Regards

Jens


On 15.11.10 16:08, "Boris Hollas" <hollas at informatik.htw-dresden.de> wrote:


>> 
>> 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.