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
move my_id parameter [part 2 of 2]
[smatch.git]
/
validation
/
sm_switch2.c
blob
1a4880c7c225c76079d780f41c84d19163ae8387
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: dereferencing undefined: 'a'
48
sm_switch2.c +32 func(21) error: dereferencing undefined: 'b'
49
* check-output-end
50
*/