File: ghost_multiline_annot.c

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 (136 lines) | stat: -rw-r--r-- 1,963 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
130
131
132
133
134
135
136
/* run.config
   STDOPT: +" -cpp-extra-args=-DP0"
 EXIT: 1
   STDOPT: +" -cpp-extra-args=-DP1"
   STDOPT: +" -cpp-extra-args=-DP2"
   STDOPT: +" -cpp-extra-args=-DP3"
   STDOPT: +" -cpp-extra-args=-DP4"
   STDOPT: +" -cpp-extra-args=-DP5"
 EXIT: 0
   STDOPT: +" -cpp-extra-args=-DP6"
   STDOPT: +" -cpp-extra-args=-DP7"
   STDOPT: +" -cpp-extra-args=-DP8"
*/
#ifdef P0
int main(int c) {
  /*@ ghost //@ requires c >= 0;
      int x = c;
      /@ loop invariant x >= 0;
         loop assigns x;
         loop variant x;
      @/
      while (x > 0) {
        x--;
      }
  */
  return 0;
}
#endif

#ifdef P1
int main()
{
  /*@ ghost
      int x = 10;
      /@ loop invariant x >= 0;
         loop assigns x;
         loop variant x;
      while (x > 0) {
        x--;
      }
  */
  return 0;
}
#endif

#ifdef P2
int main()
{
  /@ assert 2 == 2; @/
  return 0;
}
#endif

#ifdef P3
int main()
{
  assert (2 == 2); @/
  return 0;
}
#endif

#ifdef P4
int main()
{
  //@ assert (2 == 2); @/
  return 0;
}
#endif

#ifdef P5
int main()
{
  /*@ ghost
      int x = 10;
      /@ loop invariant x >= 0;
         /@ loop assigns x; @/
         loop variant x;
      @/
      while (x > 0) {
        x--;
      }
  */
  return 0;
}
#endif

#ifdef P6
int main()
{
  /*@ ghost
      int x = 10;
      /@ loop invariant x >= 0;
         //@ loop assigns x;  // ignored
         loop variant x;
      @/
      while (x > 0) {
        x--;
      }
  */
  return 0;
}
#endif

#ifdef P7
int main(int c)
{
  /*@ ghost //@ requires c >= 0;
      int x = c;
      /@ loop invariant x >= 0;
       @ loop invariant x@==@x;
       @ loop variant x;
       @/
      while (x > 0) {
        x--;
      }
  */
  return 0;
}
#endif

#ifdef P8
int main(int c)
{
  /*@ ghost //@ requires c >= 0;
    @  int x = c;
    @  /@ loop invariant x >= 0;
    @   @ loop invariant x == x;
    @   @ loop variant x;
    @   @/
    @  while (x > 0) {
    @    x--;
    @  }
    @*/
  return 0;
}
#endif