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] Validity of an array of struct


  • Subject: [Frama-c-discuss] Validity of an array of struct
  • From: rovedy at ig.com.br (Rovedy Aparecida Busquim e Silva)
  • Date: Sun, 11 Nov 2012 16:20:34 -0200

Hi,

I would like to insert a pre-condition (\valid) related with an array of
structs:

struct
{
    unsigned int G_Ativo   :1,
                 G_Tratado :1;
    float        G_Inst_Ativ;
} G_E[5];



I did some attempts but they didn't work:

/* @ requires \valid(G_E+(0..5-1).G_Tratado);
 @ requires  \valid(G_E+(0..5-1).G_Ativo);
 @ requires  \valid(G_E+(0..5-1).G_Inst_Ativ);
*/

or

/*@ requires \valid_range(G_E,0,4);*/

or

/*@ requires \valid(G_E+(0..5-1));*/

The source code is:

//---------------------------------------------------------------
#pragma JessieIntegerModel(math)
#pragma JessieTerminationPolicy(user)
#pragma JessieFloatModel(math)

float Tempo;
#define FALSE    0
#define TRUE     1

struct
{
    unsigned int G_Ativo   :1,
                 G_Tratado :1;
    float        G_Inst_Ativ;
} G_E[5];


/* @ requires \valid(G_E+(0..5-1).G_Tratado);
 @ requires  \valid(G_E+(0..5-1).G_Ativo);
 @ requires  \valid(G_E+(0..5-1).G_Inst_Ativ);
*/
void test(void)
{
  int i = 0;

  for(i=0;i<5;i++)
  {
        if(G_E[i].G_Ativo == FALSE && G_E[i].G_Inst_Ativ <= Tempo)
            G_E[i].G_Ativo = TRUE;
  }
}

//------------------------------------------------------------------

Could you help me, please?

Best regards,
Rovedy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20121111/972a73e9/attachment.html>