repo.or.cz
/
smatch.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
check_overflow: store the size in bytes instead of bits.
[smatch.git]
/
validation
/
sm_switch2.c
blob
0faa5e38843fab8aa3887df3277caa842d57f8a5
1
struct
foo
{
2
int
a
;
3
};
4
5
struct
foo
*
a
;
6
struct
foo
*
b
;
7
struct
foo
*
c
;
8
struct
foo
*
d
;
9
int
x
;
10
11
void
func
(
void
)
12
{
13
a
=
0
;
14
b
=
0
;
15
c
=
0
;
16
d
=
0
;
17
18
if
(
x
==
1
)
19
a
=
some_func
();
20
else if
(
x
==
2
)
21
b
=
some_func
();
22
else if
(
x
==
3
)
23
c
=
some_func
();
24
else
25
d
=
some_func
();
26
27
switch
(
x
) {
28
case
1
:
29
a
->
a
=
1
;
30
case
2
:
31
a
->
a
=
2
;
32
b
->
a
=
3
;
33
break
;
34
case
3
:
35
c
->
a
=
4
;
36
break
;
37
case
4
:
38
d
->
a
=
5
;
39
break
;
40
}
41
}
42
/*
43
* check-name: Smatch switch handling #2
44
* check-command: smatch sm_switch2.c
45
*
46
* check-output-start
47
sm_switch2.c +31 func(20) error: potential null derefence 'a'.
48
sm_switch2.c +32 func(21) error: potential null derefence 'b'.
49
* check-output-end
50
*/