0

From the post Understanding Frama-C slicer results, it seems Frama-C supports the forward conditioned slicing with Frama-C. For the following example test.c, I wonder how to do the forward conditioned slicing with the specific function "event". @Pascal Cuoq

/*@ requires a == 1 ;
*/ 
#include <stdio.h>
int event() { 
   int r;
   scanf("%d", &r); 
   if (r>10) return 1;
   else return 0;
}
void event_process() {
   int x=0; 
   printf("event process\n"); 
   x=1;
} 
void no_event()
{
    int y=0;    
    printf("no event\n");
}
void main ( ) {
   int a; 
   if((a=event()) == 1) 
      event_process();
   else 
      no_event();
   printf("in main\n"); 
   return;
}

I tried frama-c test.c -slice-calls event -then-on 'Slicing export' -print, why it outputs as follows:

/* Generated by Frama-C */
void event_slice_1(void)
{
  return;
}
void main(void)
{
  event_slice_1();
  return;
}
Community
  • 1
  • 1
  • Pls help, thanks @PascalCuoq – user6510683 Jun 25 '16 at 03:31
  • Your code is strange: what is the pre-condition `requires a == 1` supposed to refer to? There is no global variable called `a`. (Actually, as written, this precondition ought to be refused by Frama-C altogether.) If you mean to constrain the variable `a` in `main`, then the annotation is plain wrong. – byako Jun 25 '16 at 09:26
  • Thanks a for the reply @byako, I want to find the forward slicing when the function event() returns 1 (i.e., conditioned slicing), in this case, how to specify the "pre-condition"? Thanks! – user6510683 Jun 25 '16 at 13:34

0 Answers0