File: vla_loop.res.oracle

package info (click to toggle)
frama-c 20220511-manganese-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 66,472 kB
  • sloc: ml: 278,832; ansic: 47,093; sh: 4,823; makefile: 3,618; javascript: 2,436; python: 1,919; perl: 897; lisp: 293; xml: 62
file content (129 lines) | stat: -rw-r--r-- 3,007 bytes parent folder | download | duplicates (2)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
[kernel] Parsing vla_loop.i (no preprocessing)
/* Generated by Frama-C */
/*@ assigns \nothing;
    frees p; */
 __attribute__((__FC_BUILTIN__)) void __fc_vla_free(void *p);

/*@ assigns \result;
    assigns \result \from \nothing;
    allocates \result; */
 __attribute__((__FC_BUILTIN__)) void *__fc_vla_alloc(unsigned int size);

void awhile(int x)
{
  int *p;
  while (1) {
    {
      unsigned int __lengthof_a1;
      /*@ assert alloca_bounds: 0 < sizeof(int) * x ≤ 4294967295; */ ;
      __lengthof_a1 = (unsigned int)x;
      int *a1 = __fc_vla_alloc(sizeof(int) * __lengthof_a1);
      p = (int *)(& a1);
      if (x) {
        __fc_vla_free((void *)a1);
        break;
      }
      else {
        __fc_vla_free((void *)a1);
        continue;
      }
    }
  }
  return;
}

int f(int i)
{
  int __retres;
  {
    unsigned int __lengthof_vla;
    if (i > 1) {
      __retres = 1;
      goto return_label;
    }
    /*@ assert alloca_bounds: 0 < sizeof(int) * i ≤ 4294967295; */ ;
    __lengthof_vla = (unsigned int)i;
    int *vla = __fc_vla_alloc(sizeof(int) * __lengthof_vla);
    __retres = 0;
    __fc_vla_free((void *)vla);
  }
  return_label: return __retres;
}

int g(int c)
{
  int __retres;
  {
    int ret;
    unsigned int __lengthof_a;
    if (c <= 0) {
      __retres = 4;
      goto return_label;
    }
    /*@ assert alloca_bounds: 0 < sizeof(int) * c ≤ 4294967295; */ ;
    __lengthof_a = (unsigned int)c;
    int *a = __fc_vla_alloc(sizeof(int) * __lengthof_a);
    *(a + (c - 1)) = 3;
    ret = *(a + (c - 1));
    __retres = ret;
    __fc_vla_free((void *)a);
  }
  return_label: return __retres;
}

int main(int argc, char **argv)
{
  int *p;
  switch (argc) {
    default:
    {
      unsigned int __lengthof_a;
      /*@ assert alloca_bounds: 0 < sizeof(int) * argc ≤ 4294967295; */ ;
      __lengthof_a = (unsigned int)argc;
      int *a = __fc_vla_alloc(sizeof(int) * __lengthof_a);
      while (1) {
        p = (int *)(& a);
        break;
      }
      ;
      __fc_vla_free((void *)a);
    }
  }
  {
    unsigned int __lengthof_b;
    /*@ assert alloca_bounds: 0 < sizeof(int) * argc ≤ 4294967295; */ ;
    __lengthof_b = (unsigned int)argc;
    int *b = __fc_vla_alloc(sizeof(int) * __lengthof_b);
    while (1) {
      p = (int *)(& b);
      break;
    }
    ;
    __fc_vla_free((void *)b);
  }
  {
    unsigned int __lengthof_c;
    /*@ assert alloca_bounds: 0 < sizeof(int) * argc ≤ 4294967295; */ ;
    __lengthof_c = (unsigned int)argc;
    int *c = __fc_vla_alloc(sizeof(int) * __lengthof_c);
    switch (argc) {
      case 1: {
                p = (int *)(& c);
                break;
              }
    }
    ;
    __fc_vla_free((void *)c);
  }
  {
    unsigned int __lengthof_d;
    /*@ assert alloca_bounds: 0 < sizeof(int) * argc ≤ 4294967295; */ ;
    __lengthof_d = (unsigned int)argc;
    int *d = __fc_vla_alloc(sizeof(int) * __lengthof_d);
    switch (argc) case 1: p = (int *)(& d);
    __fc_vla_free((void *)d);
  }
  return argc;
}