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] Sum and Assert Failure in jessie



Dear all,

In the example below, I am encountering problems.

First, solvers can not prove the first loop invariant preservation. Is
this invariant correct? 

Secondly, when I add the second invariant (the \sum one), Jessie fails
with the following error:

Fatal error: exception Assert_failure("src/jessie/interp.ml", 564, 19)

Is the syntax incorrect?

typedef struct 
{
  unsigned int nb1;
  unsigned int nb2;
} MY_STRUCT2;

typedef struct 
{
  unsigned int nb_max;
  MY_STRUCT2 * tab1;
} MY_STRUCT1;
/*@
type invariant struct1_is_safe(MY_STRUCT1 struct1) =
     (struct1.nb_max == 0 && struct1.tab1 == \null)
  || (struct1.nb_max > 0 && \valid(struct1.tab1 +
(0..struct1.nb_max-1)));
*/

unsigned int func(MY_STRUCT1 *struct1)
{
unsigned int result;
unsigned int qIndex;
MY_STRUCT2 *struct2;

/*@
 loop invariant 0 <= qIndex < (*struct1).nb_max ; 
 loop invariant result == \sum(0, qIndex, \lambda integer k ;
(*struct1).tab1[k].nb1 * (*struct1).tab1[k].nb2);
 loop variant ((*struct1).nb_max - qIndex);
 */
for (qIndex = 0; qIndex < (*struct1).nb_max; qIndex++)
{
  struct2 = &(struct1->tab1[qIndex]);
  result += struct2->nb1 * struct2->nb2;
}
return result;
}


Thank you in advance,

--
Thomas P.

Ce courriel (incluant ses eventuelles pieces jointes) peut contenir des informations confidentielles et/ou protegees ou dont la diffusion est restreinte. Si vous avez recu ce courriel par erreur, vous ne devez ni le copier, ni l'utiliser, ni en divulguer le contenu a quiconque. Merci d'en avertir immediatement l'expediteur et d'effacer ce courriel de votre systeme. Astrium decline toute responsabilite en cas de corruption par virus, d'alteration ou de falsification de ce courriel lors de sa transmission par voie electronique.
This email (including any attachments) may contain confidential and/or privileged information or information otherwise protected from disclosure. If you are not the intended recipient, please notify the sender immediately, do not copy this message or any attachments and do not use it for any purpose or disclose its content to any person, but delete this message and any attachments from your system. Astrium disclaims any and all liability if this email transmission was virus corrupted, altered or falsified. 
---------------------------------------------------------------------
Astrium SAS (393 341 516 RCS Paris) - Siege social: 6 rue Laurent Pichat, 75016 Paris, France