Mercurial > hg > CbC > old > device
changeset 542:492f06738550
working... (struct init fix)
author | kono |
---|---|
date | Sun, 01 Jan 2006 18:49:07 +0900 |
parents | 4d853ee76ad6 |
children | af90edc74aa5 |
files | mc-code-arm.c mc-code-ia32.c mc-code-mips.c mc-code-powerpc.c mc-codegen.c mc-codegen.h mc-parse.c test/basic-code.c test/basic.c test/code-gen.c test/inline.c test/macro.c test/simp.c test/strinit.c test/too-long-argument.c |
diffstat | 15 files changed, 232 insertions(+), 187 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-code-arm.c Sun Jan 01 12:25:08 2006 +0900 +++ b/mc-code-arm.c Sun Jan 01 18:49:07 2006 +0900 @@ -3612,7 +3612,8 @@ } else data_mode(n->nm); align(a); - printf("\t.globl\t%s\n",n->nm); + if (n && n->sc!=STATIC) + printf("\t.globl\t%s\n",n->nm); printf("%s:\n",n->nm); }
--- a/mc-code-ia32.c Sun Jan 01 12:25:08 2006 +0900 +++ b/mc-code-ia32.c Sun Jan 01 18:49:07 2006 +0900 @@ -2074,7 +2074,8 @@ } else data_mode(n->nm); align(a); - printf(".globl\t%s\n",n->nm); + if (n && n->sc!=STATIC) + printf(".globl\t%s\n",n->nm); printf("%s:\n",n->nm); }
--- a/mc-code-mips.c Sun Jan 01 12:25:08 2006 +0900 +++ b/mc-code-mips.c Sun Jan 01 18:49:07 2006 +0900 @@ -3293,7 +3293,8 @@ } else data_mode(n->nm); align(a); - printf("\t.globl\t%s\n",n->nm); + if (n && n->sc!=STATIC) + printf("\t.globl\t%s\n",n->nm); printf("%s:\n",n->nm); }
--- a/mc-code-powerpc.c Sun Jan 01 12:25:08 2006 +0900 +++ b/mc-code-powerpc.c Sun Jan 01 18:49:07 2006 +0900 @@ -3053,7 +3053,8 @@ cstring_mode(); } else data_mode(n->nm); - printf("\t.globl\t_%s\n",n->nm); + if (n && n->sc!=STATIC) + printf("\t.globl\t_%s\n",n->nm); printf("_%s:\n",n->nm); }
--- a/mc-codegen.c Sun Jan 01 12:25:08 2006 +0900 +++ b/mc-codegen.c Sun Jan 01 18:49:07 2006 +0900 @@ -3048,10 +3048,44 @@ } extern void +flush_delayed_decl_data(NMTBL *n) +{ + int offset; + int offset0=0; + int e; + int type,sz,offset1=0; + int smode=mode; + mode = STADECL; + /* + decl_str_init + output delayed decl data + list4(offset,next,expression,type); + */ + while (decl_str_init) { + offset= car(decl_str_init); + e=caddr(decl_str_init); + type=cadddr(decl_str_init); + if (offset!=offset0) { + // make space + assign_data(list2(CONST,offset-offset0),EMPTY,n,offset0); + } + offset0 = assign_data(e,type,n,offset); + decl_str_init = cadr(decl_str_init); + } + offset = offset0; + if ((sz=(offset1+sz-offset))>0) + assign_data(list2(CONST,sz),EMPTY,n,offset0); + decl_str_init = 0; + mode=smode; +} + +extern void data_closing(NMTBL *n) { - if (!chk) + if (!chk) { + if (decl_str_init) flush_delayed_decl_data(n); emit_data_closing(n); + } } #define ARG_REORDER_DEBUG 0
--- a/mc-codegen.h Sun Jan 01 12:25:08 2006 +0900 +++ b/mc-codegen.h Sun Jan 01 18:49:07 2006 +0900 @@ -75,6 +75,7 @@ extern void ret(void); extern void gen_ret(void); extern void gen_label_call(int l); +extern void flush_delayed_decl_data(NMTBL *n); /* used by mc-cod-* */
--- a/mc-parse.c Sun Jan 01 12:25:08 2006 +0900 +++ b/mc-parse.c Sun Jan 01 18:49:07 2006 +0900 @@ -1327,49 +1327,26 @@ static void decl_data_field(int type,NMTBL *n,int offset) { - int e,t1; + int t1,t2; int foffset; - int offset0 = offset; - int offset1 = offset; - int decl_str_init_save = decl_str_init; int mode_save=mode; - NMTBL *nptr0; - int sz= size(type); int type0=type_value(type); - decl_str_init = 0; - if(cadr(type0)==-1) { + if(cadr(type0)==-1) { // no struct field defenition error(DCERR); return; } - if (mode==LDECL && LOCAL_STRUCT_INIT_STATIC) { - // uninitialized part should be 0. - // local var init cannot postponed because of assign_expr0/type - // if initialization contains expressions, - // we cannot do it in STADECL - nptr0=new_static_name("__lstruct",'_'); - nptr0->next = local_static_list; local_static_list = nptr0; - nptr0->sc = GVAR; - nptr0->ty = type; - mode=STADECL; - decl_data_field(type,nptr0,offset); - init_vars = list2( - list4(STASS,list3(LVAR,n->dsp+offset,0), - list3(RSTRUCT,list3(GVAR,0,(int)nptr0),sz),sz), - init_vars); - return; - } mode=SFDINIT; t1 = caddr(type0); /* list of fields */ + if (sym==LC) getsym(0); while(1) { - getsym(0); if (sym==PERIOD) { /* struct/union field initializaer */ getsym(0); if (sym==IDENT) { - t1 = search_struct_type(type,nptr->nm,&foffset); + t2 = search_struct_type(type,nptr->nm,&foffset); getsym(0); if (sym==ASS) { - decl_data(t1,n,foffset,0); + decl_data(t2,n,foffset,0); } else error(INERR); } else @@ -1380,31 +1357,35 @@ offset = decl_data(car(t1),n,offset,1); /* alignment? */ t1 = cadr(t1); } - if ( t1 && sym==COMMA) { conv->comma_(); continue; } + if ( t1 && sym==COMMA) { conv->comma_(); getsym(0); continue; } // if (!t1 && sym==COMMA) getsym(0); /* extra comma */ if (sym==RC) break; // premature end } mode = mode_save; - offset = offset0; - /* - decl_str_init - list4(offset,next,expression,type); - */ - while (decl_str_init) { - offset= car(decl_str_init); - e=caddr(decl_str_init); - type=cadddr(decl_str_init); - if (offset!=offset0) { - // make space - assign_data(list2(CONST,offset-offset0),EMPTY,n,offset0); - } - offset0 = assign_data(e,type,n,offset); - decl_str_init = cadr(decl_str_init); - } - offset = offset0; - if ((sz=(offset1+sz-offset))>0) - assign_data(list2(CONST,sz),EMPTY,n,offset0); - decl_str_init = decl_str_init_save; +} + +static void +local_struct_static(NMTBL *n) +{ + NMTBL *nptr0; + int t,sz = size(type),offset=0; + int smode = mode; + // uninitialized part should be 0. + // local var init cannot postponed because of assign_expr0/type + // if initialization contains expressions, + // we cannot do it in STADECL + nptr0=new_static_name("__lstruct",'_'); + nptr0->next = local_static_list; local_static_list = nptr0; + nptr0->sc = STATIC; + nptr0->ty = t = type; + mode=STADECL; + decl_data_field(type,nptr0,offset); + flush_delayed_decl_data(nptr0); + init_vars = list2( + list4(STASS,list3(LVAR,n->dsp+offset,0), + list3(RSTRUCT,list3(GVAR,0,(int)nptr0),sz),sz), + init_vars); + mode = smode; } /* @@ -1414,7 +1395,7 @@ static int decl_data(int t, NMTBL *n,int offset,int skip) { - int t0,t1,e,i,mode_save; + int t0,t1,e,i,mode_save,lc=0; conv->decl_data_(); t0 = type_value(t); @@ -1436,16 +1417,20 @@ mode = mode_save; return offset; } else if (scalar(t)) { + if (sym==LC) { lc=1; getsym(0); } e=expr1(); + if (lc) checksym(RC); mode = mode_save; //if(car(e)!=CONST && t==CHAR) // error(TYERR); - e = correct_type(e,t0); + e = correct_type(e,INT); // UNSIGND? offset = assign_data(e,t,n,offset); type=t; return offset; } else if (t0==FLOAT||t0==DOUBLE||t0==LONGLONG||t0==ULONGLONG) { + if (sym==LC) { lc=1; getsym(0); } e=expr1(); + if (lc) checksym(RC); mode = mode_save; e = correct_type(e,t0); offset = assign_data(e,t,n,offset); @@ -1499,17 +1484,19 @@ type=t; return offset; } else if (t1==STRUCT) { - if (sym==LC) { - conv->lc_(); conv->decl_data_begin_(); - mode = mode_save; + if (sym==LC) lc=1; + conv->lc_(); conv->decl_data_begin_(); + mode = mode_save; +#if LOCAL_STRUCT_INIT_STATIC + if(mode==LDECL) { + if (offset) error(-1); + local_struct_static(n); + } else +#endif decl_data_field(t,n,offset); - conv->decl_data_end_(); conv->rc_(); - checksym(RC); - return offset+size(t); - } else if (sym==RC) { /* empty case */ - conv->lc_(); - return offset; - } + conv->decl_data_end_(); conv->rc_(); + if (lc) checksym(RC); + return offset+size(t); } mode = mode_save; error(TYERR); /* should be initialization error */ @@ -3983,7 +3970,7 @@ cheap = increment_cheap(cheap,&num); symval=symval*10+ch-'0';getch(); } - if (ch=='.'||ch=='e') d=1; + if (ch=='.'||ch=='e'||ch=='f') d=1; } if (!sym) { if (!d) { @@ -4003,8 +3990,8 @@ *cheap->ptr = ch; cheap = increment_cheap(cheap,&num); getch(); - if ((ch=='-' && cheap->ptr[-1]=='e'&& cheap->ptr[-1]=='f')|| - (ch=='+' && cheap->ptr[-1]=='e'&& cheap->ptr[-1]=='f')) { + if ((ch=='-' && (cheap->ptr[-1]=='e'|| cheap->ptr[-1]=='f'))|| + (ch=='+' && (cheap->ptr[-1]=='e'|| cheap->ptr[-1]=='f'))) { *cheap->ptr = ch; cheap = increment_cheap(cheap,&num); getch();
--- a/test/basic-code.c Sun Jan 01 12:25:08 2006 +0900 +++ b/test/basic-code.c Sun Jan 01 18:49:07 2006 +0900 @@ -16,10 +16,10 @@ int a0,int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8,int a9,int a10,int a11,int a12,int a13,int a14,int a15,int a16,int a17,int a18,int a19,int a20,int a21,int a22,int a23,int a24,int a25,int a26,int a27,int a28,int a29,int a30,int a31,int a32,int a33,int a34,int a35,int a36,int a37,int a38,int a39,int a40,int a41,int a42,int a43,int a44,int a45,int a46,int a47,int a48,int a49 ) { - printf("#0073:i50: %d\n", + printf("#0018:i50: %d\n", a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 ); - printf("#0127:%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d + printf("#0021:%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 %d %d %d %d %d %d %d %d %d \n", a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42,a43,a44,a45,a46,a47,a48,a49); @@ -34,10 +34,10 @@ float a0,float a1,float a2,float a3,float a4,float a5,float a6,float a7,float a8,float a9,float a10,float a11,float a12,float a13,float a14,float a15,float a16,float a17,float a18,float a19,float a20,float a21,float a22,float a23,float a24,float a25,float a26,float a27,float a28,float a29,float a30,float a31,float a32,float a33,float a34,float a35,float a36,float a37,float a38,float a39,float a40,float a41,float a42,float a43,float a44,float a45,float a46,float a47,float a48,float a49 ) { - printf("#0084:f50: %g\n", + printf("#0036:f50: %g\n", a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 ); - printf("#0127:%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g + printf("#0039:%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g \n", a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42,a43,a44,a45,a46,a47,a48,a49); @@ -52,10 +52,10 @@ double a0,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8,double a9,double a10,double a11,double a12,double a13,double a14,double a15,double a16,double a17,double a18,double a19,double a20,double a21,double a22,double a23,double a24,double a25,double a26,double a27,double a28,double a29,double a30,double a31,double a32,double a33,double a34,double a35,double a36,double a37,double a38,double a39,double a40,double a41,double a42,double a43,double a44,double a45,double a46,double a47,double a48,double a49 ) { - printf("#0095:d50: %g\n", + printf("#0054:d50: %g\n", a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 ); - printf("#0127:%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g + printf("#0057:%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g \n", a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42,a43,a44,a45,a46,a47,a48,a49); @@ -90,6 +90,6 @@ int main() { - printf("%d\n",main0()); + printf("#0092:%d\n",main0()); return 0; }
--- a/test/basic.c Sun Jan 01 12:25:08 2006 +0900 +++ b/test/basic.c Sun Jan 01 18:49:07 2006 +0900 @@ -43,12 +43,12 @@ f = d; dd = (int*) &d; - printf("#0035:d %g\n",d); - printf("#0036:dx %08x %08x\n",*(dd),*(dd+1)); + printf("#0045:d %g\n",d); + printf("#0046:dx %08x %08x\n",*(dd),*(dd+1)); dd = (int*) &f; - printf("#0039:f %g\n",f); - printf("#0040:dx %08x \n",*(dd)); + printf("#0049:f %g\n",f); + printf("#0050:dx %08x \n",*(dd)); return 1; } @@ -59,8 +59,8 @@ int i; c=-1; i=c; - printf("#0050:%d %d %d\n",!i,~i,-i); - printf("#0051:%d\n",i); + printf("#0061:%d %d %d\n",!i,~i,-i); + printf("#0062:%d\n",i); } INLINE @@ -69,7 +69,7 @@ int a0,int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8 ) { - printf("#0059:g: %d\n", + printf("#0071:g: %d\n", a0+a1+a2+a3+a4+a5+a6+a7+a8 ); return a8; @@ -82,9 +82,9 @@ ) { #if ARG_ADDRESS - printf("#0071:i50: a0 %x a49 %x\n",&a0,&a49); + printf("#0084:i50: a0 %x a49 %x\n",&a0,&a49); #endif - printf("#0073:i50: %d\n", + printf("#0086:i50: %d\n", a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 ); return a8; @@ -96,7 +96,7 @@ float a0,float a1,float a2,float a3,float a4,float a5,float a6,float a7,float a8,float a9,float a10,float a11,float a12,float a13,float a14,float a15,float a16,float a17,float a18,float a19,float a20,float a21,float a22,float a23,float a24,float a25,float a26,float a27,float a28,float a29,float a30,float a31,float a32,float a33,float a34,float a35,float a36,float a37,float a38,float a39,float a40,float a41,float a42,float a43,float a44,float a45,float a46,float a47,float a48,float a49 ) { - printf("#0084:f50: %g\n", + printf("#0098:f50: %g\n", a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 ); return a8; @@ -108,7 +108,7 @@ double a0,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8,double a9,double a10,double a11,double a12,double a13,double a14,double a15,double a16,double a17,double a18,double a19,double a20,double a21,double a22,double a23,double a24,double a25,double a26,double a27,double a28,double a29,double a30,double a31,double a32,double a33,double a34,double a35,double a36,double a37,double a38,double a39,double a40,double a41,double a42,double a43,double a44,double a45,double a46,double a47,double a48,double a49 ) { - printf("#0095:d50: %g\n", + printf("#0110:d50: %g\n", a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 ); return a8; @@ -129,7 +129,7 @@ double a0,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8 ) { - printf("#0114:f: %g\n", + printf("#0131:f: %g\n", a0+a1+a2+a3+a4+a5+a6+a7+a8 ); return a8; @@ -140,13 +140,13 @@ tmp1 () { #if ARG_ADDRESS int a0; - printf("#0124:tmp1: a0 %x\n",&a0); + printf("#0142:tmp1: a0 %x\n",&a0); #endif - printf("#0127:%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 %d %d %d %d %d %d %d %d %d \n", + printf("#0145:%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 %d %d %d %d %d %d %d %d %d \n", 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,41,42,43,44,45,46,47,48,49 ); - printf("#0130:%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g \n", + printf("#0148:%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g \n", 0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0 ); @@ -186,60 +186,60 @@ void double_int() { - printf("#0169:%d %f %f %f %f %f %f %f %f %f %f %f\n", + printf("#0188:%d %f %f %f %f %f %f %f %f %f %f %f\n", 1,0.1,.2,.3,.4,.5,.6,.7,.8,.9,.1,.2); - printf("#0171:%d %d %f %f %f %f %f %f %f %f %f %f\n", + printf("#0190:%d %d %f %f %f %f %f %f %f %f %f %f\n", 1, 1,.2,.3,.4,.5,.6,.7,.8,.9,.1,.2); - printf("#0173:%d %d %d %f %f %f %f %f %f %f %f %f\n", + printf("#0192:%d %d %d %f %f %f %f %f %f %f %f %f\n", 1, 1, 2,.3,.4,.5,.6,.7,.8,.9,.1,.2); - printf("#0175:%d %d %d %d %f %f %f %f %f %f %f %f\n", + printf("#0194:%d %d %d %d %f %f %f %f %f %f %f %f\n", 1, 1, 2, 3,.4,.5,.6,.7,.8,.9,.1,.2); - printf("#0177:%d %d %d %d %d %f %f %f %f %f %f %f\n", + printf("#0196:%d %d %d %d %d %f %f %f %f %f %f %f\n", 1, 1, 2, 3, 4,.5,.6,.7,.8,.9,.1,.2); - printf("#0179:%d %d %d %d %d %d %f %f %f %f %f %f\n", + printf("#0198:%d %d %d %d %d %d %f %f %f %f %f %f\n", 1, 1, 2, 3, 4, 5,.6,.7,.8,.9,.1,.2); - printf("#0181:%d %d %d %d %d %d %d %f %f %f %f %f\n", + printf("#0200:%d %d %d %d %d %d %d %f %f %f %f %f\n", 1, 1, 2, 3, 4, 5, 6,.7,.8,.9,.1,.2); - printf("#0183:%d %d %d %d %d %d %d %d %f %f %f %f\n", + printf("#0202:%d %d %d %d %d %d %d %d %f %f %f %f\n", 1, 1, 2, 3, 4, 5, 6, 7,.8,.9,.1,.2); - printf("#0185:%d %d %d %d %d %d %d %d %d %f %f %f\n", + printf("#0204:%d %d %d %d %d %d %d %d %d %f %f %f\n", 1, 1, 2, 3, 4, 5, 6, 7, 8,.9,.1,.2); - printf("#0187:%d %d %d %d %d %d %d %d %d %d %f %f\n", + printf("#0206:%d %d %d %d %d %d %d %d %d %d %f %f\n", 1, 1, 2, 3, 4, 5, 6, 7, 8, 9,.1,.2); - printf("#0189:%d %d %d %d %d %d %d %d %d %d %d %f\n", + printf("#0208:%d %d %d %d %d %d %d %d %d %d %d %f\n", 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1,.2); - printf("#0191:%d %d %d %d %d %d %d %d %d %d %d %d\n", + printf("#0210:%d %d %d %d %d %d %d %d %d %d %d %d\n", 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2); - printf("#0194:%f %d %d %d %d %d %d %d %d %d %d %d\n", + printf("#0213:%f %d %d %d %d %d %d %d %d %d %d %d\n", .1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2); - printf("#0196:%f %f %d %d %d %d %d %d %d %d %d %d\n", + printf("#0215:%f %f %d %d %d %d %d %d %d %d %d %d\n", .1, .1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2); - printf("#0198:%f %f %f %d %d %d %d %d %d %d %d %d\n", + printf("#0217:%f %f %f %d %d %d %d %d %d %d %d %d\n", .1, .1,.2, 3, 4, 5, 6, 7, 8, 9, 1, 2); - printf("#0200:%f %f %f %f %d %d %d %d %d %d %d %d\n", + printf("#0219:%f %f %f %f %d %d %d %d %d %d %d %d\n", .1, .1,.2,.3, 4, 5, 6, 7, 8, 9, 1, 2); - printf("#0202:%f %f %f %f %f %d %d %d %d %d %d %d\n", + printf("#0221:%f %f %f %f %f %d %d %d %d %d %d %d\n", .1, .1,.2,.3,.4, 5, 6, 7, 8, 9, 1, 2); - printf("#0204:%f %f %f %f %f %f %d %d %d %d %d %d\n", + printf("#0223:%f %f %f %f %f %f %d %d %d %d %d %d\n", .1, .1,.2,.3,.4,.5, 6, 7, 8, 9, 1, 2); - printf("#0206:%f %f %f %f %f %f %f %d %d %d %d %d\n", + printf("#0225:%f %f %f %f %f %f %f %d %d %d %d %d\n", .1, .1,.2,.3,.4,.5,.6, 7, 8, 9, 1, 2); - printf("#0208:%f %f %f %f %f %f %f %f %d %d %d %d\n", + printf("#0227:%f %f %f %f %f %f %f %f %d %d %d %d\n", .1, .1,.2,.3,.4,.5,.6,.7, 8, 9, 1, 2); - printf("#0210:%f %f %f %f %f %f %f %f %f %d %d %d\n", + printf("#0229:%f %f %f %f %f %f %f %f %f %d %d %d\n", .1, .1,.2,.3,.4,.5,.6,.7,.8, 9, 1, 2); - printf("#0212:%f %f %f %f %f %f %f %f %f %f %d %d\n", + printf("#0231:%f %f %f %f %f %f %f %f %f %f %d %d\n", .1, .1,.2,.3,.4,.5,.6,.7,.8,.9, 1, 2); - printf("#0214:%f %f %f %f %f %f %f %f %f %f %f %d\n", + printf("#0233:%f %f %f %f %f %f %f %f %f %f %f %d\n", .1, .1,.2,.3,.4,.5,.6,.7,.8,.9,.1, 2); - printf("#0216:%f %f %f %f %f %f %f %f %f %f %f %f\n", + printf("#0235:%f %f %f %f %f %f %f %f %f %f %f %f\n", .1, .1,.2,.3,.4,.5,.6,.7,.8,.9,.1,.2); - printf("#0219:%f %d %f %d %f %d %f %d %f %d %f %d\n", + printf("#0238:%f %d %f %d %f %d %f %d %f %d %f %d\n", .1, 1,.2, 3,.4, 5,.6, 7,.8, 9,.1, 2); - printf("#0222:%d %f %d %f %d %f %d %f %d %f %d %f\n", + printf("#0241:%d %f %d %f %d %f %d %f %d %f %d %f\n", 1, .1, 2,.3, 4,.5, 6,.7, 8,.9, 1,.2); } @@ -252,7 +252,7 @@ print(1.234e-10); tmp1(); double_int(); - printf("%s", memchar ); - printf("%s", arraychar); + printf("#0254:%s", memchar ); + printf("#0255:%s", arraychar); return 0; }
--- a/test/code-gen.c Sun Jan 01 12:25:08 2006 +0900 +++ b/test/code-gen.c Sun Jan 01 18:49:07 2006 +0900 @@ -3470,12 +3470,12 @@ for(i=0;i<2;i++) { k = i==0? -4:4; - printf("#3471: cond_ulll %llu\n",k); - printf("#3472: cond_ulll %llu\n",i==0? -4LL:4LL); - printf("#3473: cond_ulll %llu\n",(unsigned long long)(i==0? -4:4)); + printf("#3472: cond_ulll %llu\n",k); + printf("#3473: cond_ulll %llu\n",i==0? -4LL:4LL); + printf("#3474: cond_ulll %llu\n",(unsigned long long)(i==0? -4:4)); k = i==0? i:j; - printf("#3475: cond_ulll %llu\n",k); - printf("#3476: cond_ulll %llu\n",i==0? i:j); + printf("#3476: cond_ulll %llu\n",k); + printf("#3477: cond_ulll %llu\n",i==0? i:j); } } @@ -3488,12 +3488,12 @@ for(i=0;i<2;i++) { k = i==0? -4:4; - printf("#3488: cond_luu %lld\n",k); - printf("#3489: cond_luu %lld\n",i==0? -4LL:4LL); - printf("#3490: cond_luu %lld\n",(unsigned long long)(i==0? -4:4)); + printf("#3490: cond_luu %lld\n",k); + printf("#3491: cond_luu %lld\n",i==0? -4LL:4LL); + printf("#3492: cond_luu %lld\n",(unsigned long long)(i==0? -4:4)); k = i==0? i:j; - printf("#3492: cond_luu %lld\n",k); - printf("#3493: cond_luu %lld\n",i==0? i:j); + printf("#3494: cond_luu %lld\n",k); + printf("#3495: cond_luu %lld\n",i==0? i:j); } }
--- a/test/inline.c Sun Jan 01 12:25:08 2006 +0900 +++ b/test/inline.c Sun Jan 01 18:49:07 2006 +0900 @@ -14,16 +14,16 @@ { volatile const int j = 3; switch(i) { - case 1: printf("#0015:1\n"); break; - case 2: printf("#0016:2\n"); break; - case 3: printf("#0017:3\n"); break; - case 4: printf("#0018:4\n"); break; + case 1: printf("#0016:1\n"); break; + case 2: printf("#0017:2\n"); break; + case 3: printf("#0018:3\n"); break; + case 4: printf("#0019:4\n"); break; } switch(j) { - case 1: printf("#0021:1\n"); break; - case 2: printf("#0022:2\n"); break; - case 3: printf("#0023:3\n"); break; - case 4: printf("#0024:4\n"); break; + case 1: printf("#0022:1\n"); break; + case 2: printf("#0023:2\n"); break; + case 3: printf("#0024:3\n"); break; + case 4: printf("#0025:4\n"); break; } return 0; } @@ -45,7 +45,7 @@ static inline int ins(int i,int j) { - printf("#0046:%d %d\n",i,j); + printf("#0047:%d %d\n",i,j); if (f(i)>j) return j; else return i; } @@ -53,7 +53,7 @@ static inline int ins1(int i,int j, int k) { - printf("#0054:%d %d %d\n",i,j,k); + printf("#0055:%d %d %d\n",i,j,k); if (f(i)>j) return j; else return i; } @@ -64,18 +64,18 @@ do { k += 3; } while ( k < j); - printf("#0065: %d do %d\n",p,k); + printf("#0066: %d do %d\n",p,k); while (k > j) { k -= 3; } - printf("#0070: %d while %d\n",p,k); + printf("#0071: %d while %d\n",p,k); m = 0; for(k=0;k<j;k++) { m += k; } - printf("#0076: %d for %d\n",p,m); + printf("#0077: %d for %d\n",p,m); switch(i) { case 1: k = 1; @@ -88,13 +88,13 @@ break; default: k = 5; } - printf("#0089: %d switch %d\n",p,k); + printf("#0090: %d switch %d\n",p,k); for(k=0;k<j;k++) { i += k; if (k<3) continue; } - printf("#0095: %d for %d\n",p,i); + printf("#0096: %d for %d\n",p,i); goto hoge; hage: goto hage; @@ -115,27 +115,27 @@ // a = 10; k1 = in1(a,b); - printf("#0116:%d %d %d\n",a,b,k1); + printf("#0117:%d %d %d\n",a,b,k1); j1 = in1(k,j-6)+f(k1); - printf("#0118:%d %d %s\n",k1,j1,hoo); + printf("#0119:%d %d %s\n",k1,j1,hoo); k1 = &v-&x>0? &v-&x : &x-&v; - printf("#0120:v-x: %d\n",k1); + printf("#0121:v-x: %d\n",k1); k1 = ins(a,b); j1 = ins(k,j-6)+f(k1); - printf("#0124:%d %d %s\n",k1,j1,haa); + printf("#0125:%d %d %s\n",k1,j1,haa); k1 = ins(as,bs); j1 = ins(k,j-6)+f(k1); - printf("#0128:%d %d %s\n",k1,j1,haa); + printf("#0129:%d %d %s\n",k1,j1,haa); k1 = ins(v,x); j1 = ins(k,j-6)+f(v); - printf("#0132:%d %d %s\n",k1,j1,haa); + printf("#0133:%d %d %s\n",k1,j1,haa); k1 = fnp(v,x,5); j1 = ins1(k,j-6,6)+f(v); - printf("#0136:%d %d %s\n",k1,j1,haa); + printf("#0137:%d %d %s\n",k1,j1,haa); } void @@ -154,13 +154,13 @@ static inline int order(int a0,int a1,int a2, int a3, int a4) { - printf("#0155:order %d %d %d %d %d\n",a0,a1,a2,a3,a4); + printf("#0156:order %d %d %d %d %d\n",a0,a1,a2,a3,a4); } static inline int order1(int a0,int a1,int a2, int a3, int a4) { - printf("#0161:orderp %d %d %d %d %d\n",a0,a1,a2,a3,a4); + printf("#0162:orderp %d %d %d %d %d\n",a0,a1,a2,a3,a4); } int (*order1p)(int a0,int a1,int a2, int a3, int a4) = order1;
--- a/test/macro.c Sun Jan 01 12:25:08 2006 +0900 +++ b/test/macro.c Sun Jan 01 18:49:07 2006 +0900 @@ -34,7 +34,7 @@ #define name_hoge(c) (c+a) - +int main() { int a,b,e; @@ -52,32 +52,32 @@ g(car(cadr(e)),cadr(e)); #endif #if 0 - printf("#0052:1\n"); + printf("#0054:1\n"); #elif (1) - printf("#0054:2\n"); + printf("#0056:2\n"); #elif (2) - printf("#0056:3\n"); + printf("#0058:3\n"); #else - printf("#0058:4\n"); + printf("#0060:4\n"); #endif #if 0 - printf("#0061:1\n"); + printf("#0063:1\n"); #elif (0) - printf("#0063:2\n"); + printf("#0065:2\n"); #elif (0) - printf("#0065:3\n"); + printf("#0067:3\n"); #else - printf("#0067:4\n"); + printf("#0069:4\n"); #endif - printf("#0069:%d\n",name(3,hoge)); - printf("#0069:%d\n",names(3,hoge)); + printf("#0071:%d\n",name(3,hoge)); + printf("#0072:%d\n",names(3,hoge)); return 0; } #if 0 #endif /* whoeh wohefwiehfoi */ -longlong(int i,int j) +void longlong(int i,int j) { // long long i,j; if (i>j) main();
--- a/test/simp.c Sun Jan 01 12:25:08 2006 +0900 +++ b/test/simp.c Sun Jan 01 18:49:07 2006 +0900 @@ -4,6 +4,8 @@ float f = 3; float g = 4096.0f; +int kk = {-3}; + int main2(int i) { @@ -27,13 +29,13 @@ { int i; - printf("#0018:%d\n",ac); + printf("#0031:%d\n",ac); for(i=0;i<ac;i++) { - printf("#0020:%s\n",&av[i][3]); + printf("#0033:%s\n",&av[i][3]); } ch = 'E'; main1(-8); - printf("%d\n",main2(3)); + printf("#0037:%d\n",main2(3)); return main0(ac,ch,av); } @@ -44,21 +46,21 @@ char *av[]; { int i; - printf("#0034:%d %c\n",ac,ch); + printf("#0048:%d %c\n",ac,ch); for(i=0;i<ac;i++) { - printf("#0036:%s\n",&av[i][3]); + printf("#0050:%s\n",&av[i][3]); } - printf("#0038:%d==1\n",alpha(ch)); + printf("#0052:%d==1\n",alpha(ch)); return 0; } void main1(int l) { - printf("#0045:%d\n", ((l+0)<-511||(l+0)>511)); - if ((l+0)<-511||(l+0)>511) printf("#0046:yes\n"); + printf("#0059:%d\n", ((l+0)<-511||(l+0)>511)); + if ((l+0)<-511||(l+0)>511) printf("#0060:yes\n"); l = -1; - printf("#0048:%d\n", l==-1? 555:333); + printf("#0062:%d\n", l==-1? 555:333); }
--- a/test/strinit.c Sun Jan 01 12:25:08 2006 +0900 +++ b/test/strinit.c Sun Jan 01 18:49:07 2006 +0900 @@ -7,6 +7,10 @@ int b; int c; int d; + struct hoge { + int k; + int j; + } m; int e; } temp1 = { // 101, @@ -24,19 +28,32 @@ .a = (int)b }; +struct temp temp4 = { 1,2,3,4,5,6,7}; +struct temp temp7 = { 1,2,3,4,{5,6},7}; +int main() { struct temp temp2 = { .c = 5, .e=99 }; - printf("#0031:1: %d\n",temp1.a); - printf("#0032:1: %d\n",temp1.e); - printf("#0033:1: %d\n",temp1.b); - printf("#0034:2: %d\n",temp2.c); - printf("#0035:2: %d\n",temp2.e); - printf("#0036:2: %d\n",temp2.b); - printf("#0037:2: %d\n",(void*)temp3.c==b); - printf("#0038:2: %d\n",temp3.c==(int)b); - printf("#0039:2: %d\n",temp3.a==(int)&b); +#ifdef WRONG + struct temp temp5 = { 1,2,3,4,5,6,7,8}; + struct temp temp6 = { 1,2,3,4,5,6}; +#else + struct temp temp5 = { 1,2,3,4,5,6,7}; + struct temp temp6 = { 1,2,3,4,5,6,7}; + struct temp temp8 = { 1,2,3,4,{5,6},7}; +#endif + printf("#0042:1: %d\n",temp1.a); + printf("#0043:1: %d\n",temp1.e); + printf("#0044:1: %d\n",temp1.b); + printf("#0045:2: %d\n",temp2.c); + printf("#0046:2: %d\n",temp2.e); + printf("#0047:2: %d\n",temp2.b); + printf("#0048:2: %d\n",(void*)temp3.c==b); + printf("#0049:2: %d\n",temp3.c==(int)b); + printf("#0050:2: %d\n",temp3.a==(int)&b); + printf("#0051:2: %d\n",temp4.m.j); + printf("#0051:2: %d\n",temp5.m.j); return 0; }
--- a/test/too-long-argument.c Sun Jan 01 12:25:08 2006 +0900 +++ b/test/too-long-argument.c Sun Jan 01 18:49:07 2006 +0900 @@ -87,13 +87,13 @@ int main() { - printf("main4\n"); + printf("#0089:main4\n"); main4(); - printf("main2\n"); + printf("#0091:main2\n"); main2(); - printf("main0\n"); + printf("#0093:main0\n"); main0(); - printf("main1\n"); + printf("#0095:main1\n"); main1(); }