16
|
1
|
|
2 int printf(char *, ...);
|
|
3 typedef void (*RET_FUNC)(int, void *);
|
|
4
|
|
5 void g(RET_FUNC func)
|
|
6 {
|
|
7 func(33, 0);
|
|
8 }
|
|
9
|
|
10 int f()
|
|
11 {
|
|
12 void *ret;
|
|
13 ret = ({
|
|
14 __label__ exit0;
|
|
15 int retval;
|
|
16 void __return_func(int retval_, void *fp){
|
|
17 retval = retval_;
|
|
18 goto exit0;
|
|
19 }
|
|
20 if (0) {
|
|
21 exit0:
|
|
22 printf("f2: fp = 0x%x\n", __builtin_frame_address(0));
|
|
23 return retval;
|
|
24 }
|
|
25 __return_func;
|
|
26 });
|
|
27
|
|
28 //g(__return_func, __builtin_frame_address(0));
|
|
29 printf("f0: fp = 0x%x\n", __builtin_frame_address(0));
|
|
30 printf("__return_func = %x\n", ret);
|
|
31 g(ret);
|
|
32
|
|
33 printf("not good\n");
|
|
34 return 0;
|
|
35
|
|
36 //exit0:
|
|
37 //printf("f2: fp = 0x%x\n", __builtin_frame_address(0));
|
|
38 //return retval;
|
|
39 }
|
|
40
|
|
41 int main(int argc, char **argv)
|
|
42 {
|
|
43 int t;
|
|
44 printf("main before: fp = 0x%x\n", __builtin_frame_address(0));
|
|
45 t = f();
|
|
46 printf("f = %d\n", t);
|
|
47 printf("main after: fp = 0x%x\n", __builtin_frame_address(0));
|
|
48 }
|
|
49
|
|
50
|