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] using errno


  • Subject: [Frama-c-discuss] using errno
  • From: Pascal.CUOQ at cea.fr (CUOQ Pascal)
  • Date: Sat, 7 Nov 2009 12:22:53 +0100
  • References: <1257549620.12758.11.camel@valin>


> someone know how to treat errno ?

___
src code:
  if (errno == 0) j=2;

the cil:
  int *tmp ;
  { /*undefined sequence*/  tmp = __errno_location(); ; }
  /*@ assert \valid(tmp);
          // synthesized
       */
  if (*tmp == 0) { j = 2; }
____

When I try to reproduce, I get:
$ cat t.i
main(){
int j;
 if (errno == 0) j=2;
}
$ /Volumes/raid/ppc/bin/toplevel.opt -print t.i
Parsing
t.i:3: Fatal error: Cannot resolve variable errno
...


It seems to me that your pre-processor did most
of the transformation here, not CIL. Could you show us
the pre-processed code corresponding to your example?

If your compilation platform is made of headers that
insert calls to __errno_location() and of libraries that
provide it, for reproducing the same context in Frama-C
you have to provide the function in a
separate C file that you should include in each of
your analysis projects.

Pascal