• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download

foo(void)1 void foo(void)
2 {
3 	void *p = &&l;
4 	{
5 l:		 ;
6 	}
7 	goto *p;			// OK
8 }
9 
bar(void)10 void bar(void)
11 {
12 	void *p = &&l;			// KO: 'jump' inside
13 	({
14 l:		 1;
15 	});
16 	goto *p;
17 }
18 
baz(void)19 void baz(void)
20 {
21 	void *p = &&l;			// KO: 'jump' inside
22 	0 ? 1 : ({
23 l:		 1;
24 		 });
25 	goto *p;
26 }
27 
qux(void)28 void qux(void)
29 {
30 	void *p = &&l;			// KO: 'jump' inside + removed
31 	1 ? 1 : ({
32 l:		 1;
33 		 });
34 	goto *p;
35 }
36 
quz(void)37 void quz(void)
38 {
39 	void *p;
40 	p = &&l;			// KO: undeclared
41 	goto *p;
42 }
43 
qxu(void)44 void qxu(void)
45 {
46 	void *p;
47 	({
48 l:		1;
49 	 });
50 	p = &&l;			// KO: 'jump' inside
51 	goto *p;
52 }
53 
qzu(void)54 void qzu(void)
55 {
56 	void *p;
57 	1 ? 1 : ({
58 l:		 1;
59 		 });
60 	p = &&l;			// KO: 'jump' inside + removed
61 	goto *p;
62 }
63 
64 
65 /*
66  * check-name: label-scope-cgoto
67  * check-command: sparse -Wno-decl $file
68  *
69  * check-error-start
70 label-scope-cgoto.c:12:19: error: label 'l' used outside statement expression
71 label-scope-cgoto.c:14:1:    label 'l' defined here
72 label-scope-cgoto.c:21:19: error: label 'l' used outside statement expression
73 label-scope-cgoto.c:23:1:    label 'l' defined here
74 label-scope-cgoto.c:30:19: error: label 'l' used outside statement expression
75 label-scope-cgoto.c:32:1:    label 'l' defined here
76 label-scope-cgoto.c:50:13: error: label 'l' used outside statement expression
77 label-scope-cgoto.c:48:1:    label 'l' defined here
78 label-scope-cgoto.c:60:13: error: label 'l' used outside statement expression
79 label-scope-cgoto.c:58:1:    label 'l' defined here
80 label-scope-cgoto.c:40:13: error: label 'l' was not declared
81  * check-error-end
82  */
83