Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[kernel] Parsing tests/rte/fptr_assert.c (with preprocessing)
[rte] annotating function f
[rte] annotating function g
[rte] annotating function h
[rte] annotating function main
/* Generated by Frama-C */
typedef int (*fptr)(int );
void g(void)
{
return;
}
int f(int x)
{
return x;
}
int h(int x)
{
return x;
}
int main(int i)
{
int __retres;
void (*fp1)();
int (*fp2)(int );
fptr ma[2] = {& f, & h};
fp1 = (void (*)())(& g);
fp2 = & f;
/*@ assert rte: function_pointer: \valid_function((void (*)(void))fp1); */
(*fp1)();
/*@ assert rte: function_pointer: \valid_function(fp2); */
(*fp2)(3);
/*@ assert rte: function_pointer: \valid_function(ma[1]); */
(*(ma[1]))(5);
/*@ assert rte: index_bound: 0 ≤ i; */
/*@ assert rte: index_bound: i < 2; */
/*@ assert rte: function_pointer: \valid_function(ma[i]); */
(*(ma[i]))(5);
__retres = 0;
return __retres;
}