Mercurial > hg > CbC > CbC_examples
view too-long-argument.c @ 17:a4f44624a253
asm longjmp (can return correct address but return value is wrong)
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 24 Jan 2016 06:01:43 +0900 |
parents | 175041088754 |
children | 586096c45873 |
line wrap: on
line source
#ifdef GCC #define __environment _CbC_environment #define __return _CbC_return #endif #include <stdio.h> #undef WRONGNUMBER typedef __code (*CCC)( int f1,int f2,int f3,int f4,int f5,int f6,int f7,int f8,int f9,int fa,int fb,int fc,int fd,int fe,int ff, __code(*ret)(int,void *), void *env); __code tcode2( int f1,int f2,int f3,int f4,int f5,int f6,int f7,int f8,int f9,int fa,int fb,int fc,int fd,int fe,int ff, __code(*ret)(int,void *), void *env) { fprintf(stdout,"#0017:tcode2: f1=%d,f2=%d,f3=%d,f4=%d,f5=%d,f6=%d,f7=%d,f8=%d,f9=%d,fa=%d,fb=%d,fc=%d,fd=%d,fe=%d,ff=%d\n", f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff); goto ret(0,env); } __code tcode1(f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff,ret,env) int f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff; __code(*ret)(int,void *); void *env; { fprintf(stdout,"#0028:tcode1: f1=%d,f2=%d,f3=%d,f4=%d,f5=%d,f6=%d,f7=%d,f8=%d,f9=%d,fa=%d,fb=%d,fc=%d,fd=%d,fe=%d,ff=%d\n", f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff); goto ret(0,env); } __code tcode4(int x,int y,CCC junction,__code(*ret)(int,void *),void *env) { #ifdef WRONGNUMBER goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,ret,env); #else goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,ret,env); #endif } __code tcode0(int x,int y,__code(*junction)(int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,__code(*)(int, void *),void *),__code(*ret)(int,void *),void *env) { #ifdef WRONGNUMBER goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,ret,env); #else goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,ret,env); #endif } int main0() { #ifdef WRONGNUMBER goto tcode2(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, __return,__environment); #else goto tcode2(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14, __return,__environment); #endif return 0; } int main1() { #ifdef WRONGNUMBER goto tcode1(0,1,2,3,4,5,6,7,8,9,10,11,12,13, __return,__environment); #else goto tcode1(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14, __return,__environment); #endif return 0; } int main2() { goto tcode0(0,1,tcode1,__return,__environment); return 0; } int main4() { goto tcode4(0,1,tcode2,__return,__environment); return 0; } int main() { printf("#0092:main4\n"); main4(); printf("#0094:main2\n"); main2(); printf("#0096:main0\n"); main0(); printf("#0098:main1\n"); main1(); return 0; }