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 {
|
620
|
16 int a[1] ;
|
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
|
655
|
31 char *q = alloca(100);
|
315
|
32 char *p = alloca(asize<100?100:asize);
|
172
|
33 for(i=0;i<100;i++) p[i]=i;
|
|
34 for(i=0;i<100;i++) k += p[i];
|
655
|
35 for(i=0;i<100;i++) q[i]=i;
|
172
|
36 return k;
|
17
|
37 }
|
172
|
38
|
|
39 int
|
|
40 f(int i,int j,int k,int *l)
|
|
41 {
|
|
42 *l = 3;
|
|
43 if (i++ >20) return *l;
|
|
44 return f(i,j,k,(int*)alloca(asize));
|
|
45 }
|
313
|
46
|
|
47 int
|
|
48 g1(int k)
|
|
49 {
|
|
50 int i;
|
|
51
|
315
|
52 char *p = ((char *)alloca(asize>100?asize:100))+k;
|
313
|
53 p -= k;
|
|
54 for(i=0;i<100;i++) p[i]=i;
|
|
55 for(i=0;i<100;i++) k += p[i];
|
|
56 return k;
|
|
57 }
|
|
58
|
|
59 int
|
|
60 f1(int i,int j,int *l,int k)
|
|
61 {
|
491
|
62 // printf("#0059:f1 &i=%x &k=%x\n",&i,&k);
|
|
63 // printf("#0060:f1 i=%d j=%d *l=%0x k=%d\n",i,j,l,k);
|
313
|
64 *l = 3;
|
491
|
65 printf("#0062:f1 i=%d j=%d *l=%0x k=%d\n",i,j,*l,k);
|
313
|
66 if (i++ >20) return *l;
|
|
67 return f1(i,j,(int*)alloca(asize),k);
|
|
68 }
|
|
69
|
|
70 void
|
|
71 f2(int k)
|
|
72 {
|
|
73 int *l;
|
|
74 if (k==1)
|
|
75 l = alloca(asize);
|
|
76 else
|
|
77 l = 0;
|
491
|
78 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
|
79 // l,
|
|
80 0,
|
|
81 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
|
|
82 );
|
|
83 }
|
|
84
|