Mercurial > hg > CbC > CbC_examples
view test_nest.c @ 5:90e6146d24cd
fix stack1.c
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 22 Oct 2014 19:02:57 +0900 |
parents | 35d6eabeadb0 |
children |
line wrap: on
line source
int printf(char *, ...); typedef void (*RET_FUNC)(int, void *); void g(RET_FUNC func) { func(33, 0); } int f() { void *ret; ret = ({ __label__ exit0; int retval; void __return_func(int retval_, void *fp){ retval = retval_; goto exit0; } if (0) { exit0: printf("f2: fp = 0x%x\n", __builtin_frame_address(0)); return retval; } __return_func; }); //g(__return_func, __builtin_frame_address(0)); printf("f0: fp = 0x%x\n", __builtin_frame_address(0)); printf("__return_func = %x\n", ret); g(ret); printf("not good\n"); return 0; //exit0: //printf("f2: fp = 0x%x\n", __builtin_frame_address(0)); //return retval; } int main(int argc, char **argv) { int t; printf("main before: fp = 0x%x\n", __builtin_frame_address(0)); t = f(); printf("f = %d\n", t); printf("main after: fp = 0x%x\n", __builtin_frame_address(0)); }