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] defining valid memory zones


  • Subject: [Frama-c-discuss] defining valid memory zones
  • From: stephane.duprat at atosorigin.com (Stéphane Duprat)
  • Date: Wed, 23 Sep 2009 02:34:59 +0200

Hi,

I don't succeed in defining valid memory zones with the \valid()
function in requires clauses.
The value analysis considers that f1 don't terminate.

test1.c:14:[kernel] warning: out of bounds read. assert \valid(adr+8);
test1.c:16:[kernel] warning: non termination detected in function f1


/*@ requires \valid(adr+ (0..100));
    requires \valid(adr+8);
*/
int f1(const char * const  adr)
{
  char buf;
  //@ assert \valid(adr+ (0..100));
  //@ assert \valid(adr+8);
  buf = *(adr+8);
  return  buf;
}

With this second trial, I got the assert verified, but even assertions
are appearing as dead-code !

test1.c:12:[value] Assertion got status valid.
test1.c:13:[value] Assertion got status valid.
test1.c:17:[kernel] warning: non termination detected in function f1

char tab1[100];
/*@ requires \valid(adr+ (0..100));
    requires \valid(adr+8);
    requires adr == &(tab1[0]);
*/
int f1(const char * const  adr)
{
  char buf;
  //@ assert \valid(adr+ (0..100));
  //@ assert \valid(adr+8);             
  buf = *(adr+8);
  return  buf;
}


Perhaps, I didn't found the good option,
I use : frama-c -lib-entry -context-valid-pointers -main f1 -val file.c

Thanks in advance for your help,

St?phane



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20090923/e60d1809/attachment.htm