]> andersk Git - splint.git/blob - test/manual.expect
Added test cases from the buffer checking chapter of the manual.
[splint.git] / test / manual.expect
1
2 sample.c:11: Fresh storage x not released before
3                 return
4    sample.c:5: Fresh storage x allocated
5 sample.c:5: Variable x declared but not used
6
7 Finished checking --- 2 code warnings, as expected
8
9 null.c:3: Dereference of possibly null pointer s: *s
10    null.c:1: Storage s may become null
11
12 Finished checking --- 1 code warning, as expected
13
14 Finished checking --- no warnings
15
16 usedef.c:11: Value *x used before definition
17 usedef.c:13: Passed storage x not completely defined
18                 (*x is undefined): getVal (x)
19 usedef.c:15: Passed storage x not completely defined
20                 (*x is undefined): mysteryVal (x)
21
22 Finished checking --- 3 code warnings, as expected
23
24 usedef.c:11: Value *x used before definition
25 usedef.c:13: Passed storage x not completely defined
26                 (*x is undefined): getVal (x)
27
28 Finished checking --- 2 code warnings, as expected
29
30 bool.c:6: Test expression for if is assignment expression: i = 3
31 bool.c:6: Test expression for if not bool, type int: i = 3
32 bool.c:7: Return value type bool does not match declared type int: b1
33 bool.c:8: Operand of ! is non-boolean (int): !i
34 bool.c:8: Right operand of || is non-boolean (char *): !i || s
35 bool.c:10: Test expression for if not bool, type char *: s
36 bool.c:12: Use of == with bool variables (risks inconsistency because
37               of multiple true values): b1 == b2
38
39 Finished checking --- 7 code warnings, as expected
40
41 palindrome.c:6: Cast from underlying
42     abstract type mstring: (char *)s
43 palindrome.c:7: Function strlen expects arg
44     1 to be char * gets mstring: s
45 palindrome.c:11: Array fetch from non-array
46     (mstring): s[len - i - 1]
47 palindrome.c:19: Function isPalindrome
48     expects arg 1 to be mstring gets char *:
49     "bob"
50
51 Finished checking --- 4 code warnings, as
52 expected
53
54 only.c:11: Only storage glob (type int *) not released
55               before assignment: glob = y
56    only.c:1: Storage glob becomes only
57 only.c:11: Implicitly temp storage y assigned to only:
58               glob = y
59 only.c:13: Dereference of possibly null pointer m: *m
60    only.c:8: Storage m may become null
61 only.c:13: Variable x used after being released
62    only.c:12: Storage x released
63 only.c:14: Implicitly temp storage z returned as only:
64               z
65 only.c:14: Fresh storage m not released before return
66    only.c:9: Fresh storage m allocated
67
68 Finished checking --- 6 code warnings, as expected
69
70 stack.c:12: Stack-allocated storage &loc reachable
71                from return value: &loc
72 stack.c:12: Stack-allocated storage *x reachable from
73                parameter x
74    stack.c:10: Storage *x becomes stack
75 stack.c:12: Stack-allocated storage glob reachable
76                from global glob
77    stack.c:9: Storage glob becomes stack
78
79 Finished checking --- 3 code warnings, as expected
80
81 rstring.c:13: Reference counted storage returned
82                  without modifying reference count: r1
83
84 Finished checking --- 1 code warning, as expected
85
86 unique.c:7: Parameter 1 (s) to function strcpy is
87     declared unique but may be aliased externally by
88     parameter 2 (t)
89
90 Finished checking --- 1 code warning, as expected
91
92 exposure.c:6: Function returns reference to
93                  parameter e: e->name
94 exposure.c:6: Return value exposes rep of
95                  employee: e->name
96 exposure.c:6: Released storage e->name reachable
97                  from parameter at return point
98    exposure.c:6: Storage e->name is released
99 exposure.c:23: Suspect modification of observer
100                   name: *name = toupper(*name)
101
102 Finished checking --- 4 code warnings, as
103 expected
104
105 modify.c:4: Undocumented modification of *y: *y = *x
106 modify.c:5: Suspect object listed in modifies of setx
107                not modified: *x
108    modify.c:1: Declaration of setx
109
110 Finished checking --- 2 code warnings, as expected
111
112 globals.c:5: Undocumented use of global glob2
113 globals.c:3: Global glob1 listed but not used
114
115 Finished checking --- 2 code warnings, as expected
116
117 annotglobs.c:13: Undef global globnum used before
118                     definition
119 annotglobs.c:15: Global storage globname contains 1
120     undefined field when call returns: firstname
121 annotglobs.c:21: Only storage globname.firstname (type
122     char *) derived from killed global is not released
123     (memory leak)
124
125 Finished checking --- 3 code warnings, as expected
126
127 Finished checking --- no warnings
128
129 order.c:11: Expression has undefined behavior (value of
130     right operand modified by left operand): x++ * x
131 order.c:13: Expression has undefined behavior (left operand
132     uses i, modified by right operand): y[i] = i++
133 order.c:14: Expression has undefined behavior (value of
134     right operand modified by left operand):
135     modglob() * glob
136 order.c:15: Expression has undefined behavior
137     (unconstrained function mystery used in left operand
138     may set global variable glob used in right operand):
139     mystery() * glob
140
141 Finished checking --- 4 code warnings, as expected
142
143 order.c:11: Expression has undefined behavior (value
144     of right operand modified by left operand):
145     x++ * x
146 order.c:13: Expression has undefined behavior (left
147     operand uses i, modified by right operand):
148     y[i] = i++
149 order.c:14: Expression has undefined behavior (value
150     of right operand modified by left operand):
151     modglob() * glob
152
153 Finished checking --- 3 code warnings, as expected
154
155 loop.c:14: Suspected infinite loop.  No value used in
156     loop test (x, glob1) is modified by test or loop
157     body.
158 loop.c:15: Suspected infinite loop.  No condition
159     values modified.  Modification possible through
160     unconstrained calls: h
161
162 Finished checking --- 2 code warnings, as expected
163
164 loop.c:14: Suspected infinite loop.  No value used in
165     loop test (x, glob1) is modified by test or loop
166     body.
167
168 Finished checking --- 1 code warning, as expected
169
170 switch.c:11: Fall through case (no preceding break)
171 switch.c:14: Missing case in switch: DEFINITELY
172
173 Finished checking --- 2 code warnings, as expected
174
175 noeffect.c:6: Statement has no effect: y == *x
176 noeffect.c:7: Statement has no effect: nomodcall(x)
177 noeffect.c:8: Statement has no effect (possible
178     undected modification through call to
179     unconstrained function mysterycall):
180     mysterycall(x)
181
182 Finished checking --- 3 code warnings, as expected
183
184 noeffect.c:6: Statement has no effect: y == *x
185 noeffect.c:7: Statement has no effect: nomodcall(x)
186
187 Finished checking --- 2 code warnings, as expected
188
189 ignore.c:8: Return value (type int) ignored: fi()
190 ignore.c:10: Return value (type bool) ignored: fb()
191
192 Finished checking --- 2 code warnings, as expected
193
194 ignore.c:8: Return value (type int) ignored: fi()
195
196 Finished checking --- 1 code warning, as expected
197
198 ignore.c:10: Return value (type bool) ignored: fb()
199
200 Finished checking --- 1 code warning, as expected
201
202 setChar.c:5: Possible out-of-bounds store:
203     buf[10]
204     Unable to resolve constraint:
205     requires 9 >= 10
206      needed to satisfy precondition:
207     requires maxSet(buf @ setChar.c:5) >= 10
208
209 Finished checking --- 1 code warning, as expected
210
211 multiError.c:4: Possible out-of-bounds store:
212     buf[2]
213     Unable to resolve constraint:
214     requires maxSet(buf @ multiError.c:4) >= 2
215      needed to satisfy precondition:
216     requires maxSet(buf @ multiError.c:4) >= 2
217
218 Finished checking --- 1 code warning, as expected
219
220 updateMyEnv.c:16: Possible out-of-bounds store:
221     strcpy(str, tmp)
222     Unable to resolve constraint:
223     requires maxSet(str @ updateMyEnv.c:16) >=
224     maxRead(getenv("MYENV") @ updateMyEnv.c:14)
225      needed to satisfy precondition:
226     requires maxSet(str @ updateMyEnv.c:16) >=
227     maxRead(tmp @ updateMyEnv.c:16)
228      derived from strcpy precondition: requires
229     maxSet(<parameter 1>) >= maxRead(<parameter 2>)
230
231 Finished checking --- 1 code warning, as expected
232
233 Finished checking --- no warnings
This page took 0.098977 seconds and 5 git commands to generate.