# HG changeset patch # User Kaito Tokumori # Date 1389522078 -32400 # Node ID 89d24aeb122e4e1f5c677e08984a7c29ca6475a1 # Parent 7c8d5d4074b8fe72cabff2c3132353ad4e1dc3cb add goal.c diff -r 7c8d5d4074b8 -r 89d24aeb122e goal.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/goal.c Sun Jan 12 19:21:18 2014 +0900 @@ -0,0 +1,36 @@ +#include +#include +#include + +__attribute__((noinline)) +__code code1(void *__return,void *__enviroment){ + void(*ret)(void *); + printf("code1\n"); + ret = (void(*)(void *))__return; + ret(__enviroment); +} + +void *return1 (void* env){ + printf("return1\n"); + longjmp(*(jmp_buf*)env,1); +} + +void main1 (){ + void *__return; + void *__enviroment; + printf("main1 entry\n"); + __enviroment = (void*)malloc(sizeof(jmp_buf)); + if (setjmp(__enviroment)){ + free(__enviroment); + printf("main1 return\n"); + return; + } + __return = (void*)return1; + goto code1(__return,__enviroment); +} + +int main (){ + main1(); + printf("returned\n"); + return 1; +}