363
|
1 /*
|
|
2
|
|
3 gcc -g -std=gnu99 test/scope.c
|
|
4
|
|
5 */
|
|
6
|
|
7 #include <stdio.h>
|
|
8
|
|
9 void
|
|
10 f(int *i,void *label)
|
|
11 {
|
|
12 static int k = 3;
|
|
13 {
|
|
14 static int k = 3;
|
|
15 *i = k++;
|
|
16 }
|
|
17 k--;
|
|
18 printf("f %d\n",k);
|
|
19 }
|
|
20
|
|
21 int
|
|
22 main()
|
|
23 {
|
|
24 int i,k;
|
|
25 void *exit = &&exit0;
|
|
26 i = 3;k=10;
|
|
27 for(int k=0;k<10;k++) {
|
|
28 int i;
|
|
29 i = 4;
|
|
30 if (({
|
|
31 __label__ exit0;
|
|
32 int i;
|
|
33 f(&i,&&exit0);
|
|
34 if (i==5)
|
|
35 goto exit0;
|
|
36 printf("2nd inner %d %d %0x\n",i,k,&&exit1==exit);
|
|
37 exit0:
|
|
38 i;
|
|
39 })!=7) {
|
|
40 goto exit1;
|
|
41 } else
|
|
42 goto *exit;
|
|
43 exit1:
|
|
44 printf("inner %d %d %0x\n",i,k,&&exit1==exit);
|
|
45 }
|
|
46 k++;
|
|
47 exit0:
|
|
48 printf("outer %d %d %0x\n",i,k,&&exit0==exit);
|
|
49 return 0;
|
|
50 }
|