Mercurial > hg > CbC > old > device
changeset 545:2f577690bcfb
*** empty log message ***
author | kono |
---|---|
date | Mon, 02 Jan 2006 14:38:51 +0900 |
parents | dbfd6e88e2c3 |
children | 9cdd602cc050 |
files | Makefile test/bitfield.c test/bitfield1.c test/const.c test/obsf2.c test/scope.code-out test/switch.c test/tmp.c test/too-long-argument.c test/too-long-argument.code-out |
diffstat | 10 files changed, 118 insertions(+), 92 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Mon Jan 02 12:55:17 2006 +0900 +++ b/Makefile Mon Jan 02 14:38:51 2006 +0900 @@ -114,6 +114,7 @@ make check-code$(MK) TARGET=test/tmp4 make check-code$(MK) TARGET=test/tmp6 make check-code$(MK) TARGET=test/scope + make check-code$(MK) TARGET=test/too-long-argument check-nkf: ( cd nkf203; $(CC) -g -o nkf1 nkf.c utf8tbl.c )
--- a/test/bitfield.c Mon Jan 02 12:55:17 2006 +0900 +++ b/test/bitfield.c Mon Jan 02 14:38:51 2006 +0900 @@ -42,6 +42,15 @@ PTE g; +static void main2(); +static void main5(); +static void main5c(); +static int main3(); +static int main4(); +static void main6(); +static void main7(); + +int main() { PTE a,*p; @@ -67,28 +76,28 @@ g.u[1]=0; printf("#0068:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. v = 3; + g.pte. v = 1; printf("#0070:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. vsid = -1; + g.pte. vsid = 0xffffff; printf("#0072:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. h = 3; + g.pte. h = 1; printf("#0074:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); g.pte. api = 3; printf("#0076:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); g.pte. rpn = 3; printf("#0078:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. r = 3; + g.pte. r = 1; printf("#0081:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. c = 3; + g.pte. c = 1; printf("#0083:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. w = 3; + g.pte. w = 1; printf("#0085:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. i = 3; + g.pte. i = 1; printf("#0087:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. m = 3; + g.pte. m = 1; printf("#0089:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. g = 3; + g.pte. g = 1; printf("#0091:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); g.pte. pp = 3; printf("#0093:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); @@ -127,30 +136,30 @@ g.u[1]=-1; printf("#0128:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. v = 0x5555555; + g.pte. v = 0; printf("#0130:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. vsid = 0x5555555; + g.pte. vsid = 0x555555; printf("#0132:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. h = 0x5555555; + g.pte. h = 0; printf("#0134:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. api = 0x5555555; + g.pte. api = 0x15; printf("#0136:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. rpn = 0x5555555; + g.pte. rpn = 0x55555; printf("#0138:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. r = 0x5555555; + g.pte. r = 1; printf("#0141:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. c = 0x5555555; + g.pte. c = 1; printf("#0143:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. w = 0x5555555; + g.pte. w = 1; printf("#0145:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. i = 0x5555555; + g.pte. i = 1; printf("#0147:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. m = 0x5555555; + g.pte. m = 1; printf("#0149:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. g = 0x5555555; + g.pte. g = 1; printf("#0151:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.pte. pp = 0x5555555; + g.pte. pp = 3; printf("#0153:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); g.u[0]=-1; @@ -197,7 +206,7 @@ main7(); return 0; } - +void main2() { int i = 0; @@ -206,30 +215,30 @@ g.u[1]=0; printf("#0207:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. v = 3; + g.sg. v = 1; printf("#0209:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. vsid = -1; + g.sg. vsid = 0xffffff; printf("#0211:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. h = 3; + g.sg. h = 1; printf("#0213:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. api = 3; + g.sg. api = 1; printf("#0215:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. rpn = 3; + g.sg. rpn = 1; printf("#0217:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. r = 3; + g.sg. r = 1; printf("#0220:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. c = 3; + g.sg. c = 1; printf("#0222:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. w = 3; + g.sg. w = 1; printf("#0224:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. i = 3; + g.sg. i = 1; printf("#0226:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. m = 3; + g.sg. m = 1; printf("#0228:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. g = 3; + g.sg. g = 1; printf("#0230:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. pp = 3; + g.sg. pp = 0x3; printf("#0232:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); g.u[0]=-1; @@ -266,30 +275,30 @@ g.u[1]=-1; printf("#0267:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. v = 0x55; + g.sg. v = 0; printf("#0269:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. vsid = 0x5555555; + g.sg. vsid = 0; printf("#0271:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. h = 0x5555555; + g.sg. h = 0; printf("#0273:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. api = 0x55; + g.sg. api = 0; printf("#0275:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. rpn = 0x5555555; + g.sg. rpn = 0; printf("#0277:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. r = 0x5555555; + g.sg. r = 0; printf("#0280:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. c = 0x5555555; + g.sg. c = 0; printf("#0282:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. w = 0x5555555; + g.sg. w = 0; printf("#0284:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. i = 0x5555555; + g.sg. i = 0; printf("#0286:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. m = 0x5555555; + g.sg. m = 0; printf("#0288:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. g = 0x5555555; + g.sg. g = 0; printf("#0290:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); - g.sg. pp = 0x5555555; + g.sg. pp = 3; printf("#0292:% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]); g.u[0]=-1; @@ -330,6 +339,7 @@ // int :12 bit-field cannot be a return value; // main3( int a:8 ) bit-field cannot be an argument; +int main3( int a ) { // int b:9; // nor local variable @@ -401,7 +411,7 @@ return --b; } - +int main4( int a ) { // int b:9; // nor local variable @@ -504,10 +514,10 @@ union ll { int a[8]; struct { - char a:4; - long long v:56; - long long w:56; - long long x:56; + unsigned char a:4; + unsigned long long v:56; + unsigned long long w:56; + unsigned long long x:56; } b; } ll; @@ -539,12 +549,13 @@ int p1 = 1; int zero = 0; +void main5c() { ii.b.a = -1; printf("#0544:m5c-00:%d\n",ii.b.a); - ll1.b.v = 0x123456789abcdefLL; + ll1.b.v = 0x123456defLL; printf("#0547:m5c-01:%llx\n",ll1.b.v); printf("#0548:m5c-02:%08x %08x %08x %08x %08x %08x %08x %08x\n", ll1.a[0],ll1.a[1],ll1.a[2],ll1.a[3], @@ -552,14 +563,14 @@ ); ll1.b.v = 0; printf("#0553:m5c-01:%llx\n", - ll1.b.w = 0x123456789abcdefLL); + ll1.b.w = 0x123456defLL); printf("#0555:m5c-02:%08x %08x %08x %08x %08x %08x %08x %08x\n", ll1.a[0],ll1.a[1],ll1.a[2],ll1.a[3], ll1.a[4],ll1.a[5],ll1.a[6],ll1.a[7] ); ll1.b.w = 0; printf("#0560:m5c-01:%llx\n", - ll1.b.x = 0x123456789abcdefLL); + ll1.b.x = -0x12456defLL); printf("#0562:m5c-02:%08x %08x %08x %08x %08x %08x %08x %08x\n", ll1.a[0],ll1.a[1],ll1.a[2],ll1.a[3], ll1.a[4],ll1.a[5],ll1.a[6],ll1.a[7] @@ -567,7 +578,7 @@ ll1.b.x = 0; printf("#0568:m5c-01:%llx\n", - ll0.b.v = 0x123456789abcdefLL); + ll0.b.v = 0x123457cdefLL); printf("#0570:m5c-01:%llx\n",ll0.b.v); printf("#0571:m5c-02:%08x %08x %08x %08x %08x %08x %08x %08x\n", ll0.a[0],ll0.a[1],ll0.a[2],ll0.a[3], @@ -575,14 +586,14 @@ ); ll0.b.v = 0; printf("#0576:m5c-01:%llx\n", - ll0.b.w = 0x123456789abcdefLL); + ll0.b.w = 0x1234abcdefLL); printf("#0578:m5c-02:%08x %08x %08x %08x %08x %08x %08x %08x\n", ll0.a[0],ll0.a[1],ll0.a[2],ll0.a[3], ll0.a[4],ll0.a[5],ll0.a[6],ll0.a[7] ); ll0.b.w = 0; printf("#0583:m5c-01:%llx\n", - ll0.b.x = 0x123456789abcdefLL); + ll0.b.x = 0x1234abcdefLL); printf("#0585:m5c-02:%08x %08x %08x %08x %08x %08x %08x %08x\n", ll0.a[0],ll0.a[1],ll0.a[2],ll0.a[3], ll0.a[4],ll0.a[5],ll0.a[6],ll0.a[7] @@ -590,7 +601,7 @@ ll0.b.x = 0; printf("#0591:m5c-01:%llx\n", - ll.b.v = 0x123456789abcdefLL); + ll.b.v = 0x12389abcdefLL); printf("#0593:m5c-1:%llx\n",ll.b.v); printf("#0594:m5c-2:%08x %08x %08x %08x %08x %08x %08x %08x\n", ll.a[0],ll.a[1],ll.a[2],ll.a[3], @@ -598,14 +609,14 @@ ); ll.b.v = 0; printf("#0599:m5c-01:%llx\n", - ll.b.w = 0x123456789abcdefLL); + ll.b.w = 0x12389abcdefLL); printf("#0601:m5c-2:%08x %08x %08x %08x %08x %08x %08x %08x\n", ll.a[0],ll.a[1],ll.a[2],ll.a[3], ll.a[4],ll.a[5],ll.a[6],ll.a[7] ); ll.b.w = 0; printf("#0606:m5c-01:%llx\n", - ll.b.x = 0x123456789abcdefLL); + ll.b.x = 0x12389abcdefLL); printf("#0608:m5c-2:%08x %08x %08x %08x %08x %08x %08x %08x\n", ll.a[0],ll.a[1],ll.a[2],ll.a[3], ll.a[4],ll.a[5],ll.a[6],ll.a[7] @@ -680,6 +691,7 @@ printf("#0679:m5c-5:%d %d\n",ii.b.a,ii.b.d); } +void main5() { ii.b.a = -1; @@ -813,7 +825,7 @@ printf("#0812:5:%d %d\n",ii.b.a,ii.b.d); } - +int main3l( int a ) { // int b:9; // nor local variable @@ -886,7 +898,7 @@ return --b; } - +void main6() { int i =0; @@ -1019,7 +1031,7 @@ g.pte.api = 63; printf("#1019:main5: %d %d\n",i++,g.pte.api); } - +void main7() { int i; @@ -1048,7 +1060,7 @@ } else { printf("#1048:main 7:4 %d no\n",i); } - if (g.sg.v==1) { + if (g.sg.v==1) { // always false printf("#1051:main 7:5 %d yes\n",i); } else { printf("#1053:main 7:5 %d no\n",i);
--- a/test/bitfield1.c Mon Jan 02 12:55:17 2006 +0900 +++ b/test/bitfield1.c Mon Jan 02 14:38:51 2006 +0900 @@ -72,7 +72,8 @@ int f:4; } b; } ii; - +void main5(); +int main() { int i; @@ -178,7 +179,7 @@ return 0; } - +void main5() { int i,j,bit=1; @@ -199,7 +200,7 @@ bit=1; for(j=0;j<32;j++,bit<<=1) { ll.a[i] = bit; - printf("#0201:02:%08x %08x %08x %08x %08x %08x %08x %08x\n", + printf("#0201:02:%02x %02x %02x %02x %02x %02x %02x %02x\n", ll.a[0],ll.a[1],ll.a[2],ll.a[3], ll.a[4],ll.a[5],ll.a[6],ll.a[7] );
--- a/test/const.c Mon Jan 02 12:55:17 2006 +0900 +++ b/test/const.c Mon Jan 02 14:38:51 2006 +0900 @@ -1,5 +1,5 @@ int printf(const char *format, ...); - +int main() { int i; @@ -110,7 +110,7 @@ i = -( 0x555<<28 ); printf("#0109:96:\t%x\n",i); i = -( 0x555<<29 ); printf("#0110:97:\t%x\n",i); i = -( 0x555<<30 ); printf("#0111:98:\t%x\n",i); -i = -( 0x555<<31 ); printf("#0112:99:\t%x\n",i); +// i = -( 0x555<<31 ); printf("#0112:99:\t%x\n",i); i = -( 1 ); printf("#0114:100:\t%x\n",i); i = -( 3 ); printf("#0115:101:\t%x\n",i); @@ -143,7 +143,7 @@ i = -( 536870911 ); printf("#0142:128:\t%x\n",i); i = -( 1073741823 ); printf("#0143:129:\t%x\n",i); i = -( 2147483647 ); printf("#0144:130:\t%x\n",i); -i = -( 4294967295 ); printf("#0145:131:\t%x\n",i); +// i = -( 4294967295 ); printf("#0145:131:\t%x\n",i); i += 0x555<<0; printf("#0147:132:\t%x\n",i); i += 0x555<<1; printf("#0148:133:\t%x\n",i); @@ -242,7 +242,7 @@ i += -( 0x555<<28 ); printf("#0241:224:\t%x\n",i); i += -( 0x555<<29 ); printf("#0242:225:\t%x\n",i); i += -( 0x555<<30 ); printf("#0243:226:\t%x\n",i); -i += -( 0x555<<31 ); printf("#0244:227:\t%x\n",i); +// i += -( 0x555<<31 ); printf("#0244:227:\t%x\n",i); i += -( 1 ); printf("#0246:228:\t%x\n",i); i += -( 3 ); printf("#0247:229:\t%x\n",i); @@ -276,4 +276,5 @@ i += -( 1073741823 ); printf("#0275:257:\t%x\n",i); i += -( 2147483647 ); printf("#0276:258:\t%x\n",i); i += -( 4294967295 ); printf("#0277:259:\t%x\n",i); +return 0; }
--- a/test/obsf2.c Mon Jan 02 12:55:17 2006 +0900 +++ b/test/obsf2.c Mon Jan 02 14:38:51 2006 +0900 @@ -11,21 +11,21 @@ int a,b; s P[15],Q[15]; - -o(x,y){ +void +o(int x,int y){ a=80*(y/2)+x,b= 1+(y&1); e?(m[a]|=b):(m[a]&=~b); printf("#0018:x %02x y %02x a %04x m[a] %02x\n",x,y,a,m[a]); } - +void W(s*p,s*q){ s t; t=*p; *p=*q; *q=t; } - +void l(s p, s q){ s t; int x=p.x-q.x, @@ -59,23 +59,23 @@ p.x+=v; } } -} - +} extern int rand(); +void r(s*p,s q){ p->x=((rand()%80)-q.x)/11; p->y=((rand()%48)-q.y)/11; printf("#0066:r: p->x %02x p->y %02x\n",p->x,p->y); } - +void d(s*p,s q,s r){ printf("#0070:d0: q->x %02x q->y %02x\n",q.x,q.y); printf("#0071:d1: r->x %02x r->y %02x\n",r.x,r.y); p->x=q.x+r.x; p->y=q.y+r.y; printf("#0074:d2: p->x %02x p->y %02x\n",p->x,p->y); -} - -main(i,j,k){ +} extern void srand(int); +int +main(int i,int j,int k){ s R,S; int count; i=0, @@ -108,6 +108,7 @@ putchar(c[M[a]]); } } +return 0; }
--- a/test/scope.code-out Mon Jan 02 12:55:17 2006 +0900 +++ b/test/scope.code-out Mon Jan 02 14:38:51 2006 +0900 @@ -1,3 +1,4 @@ +test/scope.c,main,31 #0017:f 2 #0035:2nd inner 3 0 0 #0045:inner 4 0 0
--- a/test/switch.c Mon Jan 02 12:55:17 2006 +0900 +++ b/test/switch.c Mon Jan 02 14:38:51 2006 +0900 @@ -5,7 +5,7 @@ int main3(int i); int main4(int i); int main5(int i); - +int main(int ac,char *av[]) { int i; @@ -16,8 +16,9 @@ main4(i); main5(i); } + return 0; } - +int main1(int i) { switch(i) { @@ -404,7 +405,7 @@ case 399: printf("#0403:case 1 399\n"); break; } } - +int main2(int i) { switch(i) { @@ -732,7 +733,7 @@ default: printf("#0731:default 2 %d\n",i); break; } } - +int main3(int i) { switch(i) { @@ -1123,7 +1124,7 @@ case 10299: printf("#1122:case 3 10299\n"); break; } } - +int main4(int i) { switch(i) { @@ -1232,7 +1233,7 @@ case 79: printf("#1231:case 4 79\n"); break; } } - +int main5(int r) { int i,j,k;
--- a/test/tmp.c Mon Jan 02 12:55:17 2006 +0900 +++ b/test/tmp.c Mon Jan 02 14:38:51 2006 +0900 @@ -12,11 +12,11 @@ return k+1; } -main0(ac,av) +main0(ac,av) // implicit defenition { return ac; } - +int main(ac,av) int ac; char *av[]; @@ -25,7 +25,7 @@ register char *p; p = av[1]; - if (!p) return; + if (!p) return 1; i = p[1]; p = p+i; printf("#0030:%d %s\n",i,p-i);
--- a/test/too-long-argument.c Mon Jan 02 12:55:17 2006 +0900 +++ b/test/too-long-argument.c Mon Jan 02 14:38:51 2006 +0900 @@ -12,7 +12,7 @@ code(*ret)(int), void *env) { -fprintf(stderr,"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", +fprintf(stdout,"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; } @@ -23,7 +23,7 @@ code(*ret)(int); void *env; { -fprintf(stderr,"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", +fprintf(stdout,"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; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/too-long-argument.code-out Mon Jan 02 14:38:51 2006 +0900 @@ -0,0 +1,8 @@ +#0089:main4 +tcode2: f1=0,f2=1,f3=2,f4=3,f5=4,f6=5,f7=6,f8=7,f9=8,fa=9,fb=10,fc=11,fd=12,fe=13,ff=14 +#0091:main2 +tcode1: f1=0,f2=1,f3=2,f4=3,f5=4,f6=5,f7=6,f8=7,f9=8,fa=9,fb=10,fc=11,fd=12,fe=13,ff=14 +#0093:main0 +tcode2: f1=0,f2=1,f3=2,f4=3,f5=4,f6=5,f7=6,f8=7,f9=8,fa=9,fb=10,fc=11,fd=12,fe=13,ff=14 +#0095:main1 +tcode1: f1=0,f2=1,f3=2,f4=3,f5=4,f6=5,f7=6,f8=7,f9=8,fa=9,fb=10,fc=11,fd=12,fe=13,ff=14