467
|
1 int printf(const char *format, ...);
|
|
2
|
312
|
3 #include <alloca.h>
|
17
|
4
|
172
|
5 int asize = 100;
|
|
6
|
|
7 int f(int i,int j,int k,int *l);
|
|
8 int g();
|
313
|
9 int f1(int i,int j,int *l,int k);
|
|
10 int g1(int k);
|
|
11 void f2();
|
172
|
12
|
|
13 int
|
|
14 main()
|
|
15 {
|
|
16 int a[0] ;
|
315
|
17 for(asize=4;asize<64000;asize=asize*2+12) {
|
|
18 f2(1);
|
|
19 f2(0);
|
491
|
20 printf("#0019:%d %d\n",g(),f(0,1,2,a));
|
|
21 printf("#0020:%d %d\n",g1(100),f1(0,1,a,2));
|
315
|
22 }
|
172
|
23 return 0;
|
|
24 }
|
17
|
25
|
|
26 int
|
172
|
27 g()
|
17
|
28 {
|
172
|
29 int k = 0,i;
|
|
30
|
315
|
31 char *p = alloca(asize<100?100:asize);
|
172
|
32 for(i=0;i<100;i++) p[i]=i;
|
|
33 for(i=0;i<100;i++) k += p[i];
|
|
34 return k;
|
17
|
35 }
|
172
|
36
|
|
37 int
|
|
38 f(int i,int j,int k,int *l)
|
|
39 {
|
|
40 *l = 3;
|
|
41 if (i++ >20) return *l;
|
|
42 return f(i,j,k,(int*)alloca(asize));
|
|
43 }
|
313
|
44
|
|
45 int
|
|
46 g1(int k)
|
|
47 {
|
|
48 int i;
|
|
49
|
315
|
50 char *p = ((char *)alloca(asize>100?asize:100))+k;
|
313
|
51 p -= k;
|
|
52 for(i=0;i<100;i++) p[i]=i;
|
|
53 for(i=0;i<100;i++) k += p[i];
|
|
54 return k;
|
|
55 }
|
|
56
|
|
57 int
|
|
58 f1(int i,int j,int *l,int k)
|
|
59 {
|
491
|
60 // printf("#0059:f1 &i=%x &k=%x\n",&i,&k);
|
|
61 // printf("#0060:f1 i=%d j=%d *l=%0x k=%d\n",i,j,l,k);
|
313
|
62 *l = 3;
|
491
|
63 printf("#0062:f1 i=%d j=%d *l=%0x k=%d\n",i,j,*l,k);
|
313
|
64 if (i++ >20) return *l;
|
|
65 return f1(i,j,(int*)alloca(asize),k);
|
|
66 }
|
|
67
|
|
68 void
|
|
69 f2(int k)
|
|
70 {
|
|
71 int *l;
|
|
72 if (k==1)
|
|
73 l = alloca(asize);
|
|
74 else
|
|
75 l = 0;
|
491
|
76 printf("#0075:f2: %0x %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
|
313
|
77 // l,
|
|
78 0,
|
|
79 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40
|
|
80 );
|
|
81 }
|
|
82
|