changeset 553:293f827ccfb2 linux-kernel-source

Linux kernel source compiled.
author kono
date Thu, 05 Jan 2006 21:29:55 +0900
parents 74bbea56b8e5
children dc677ac7a744
files .gdbinit Changes mc-code-arm.c mc-code-ia32.c mc-code-mips.c mc-code-powerpc.c mc-codegen.c mc-inline.c mc-macro.c mc-parse.c test/bitfield1.c test/inline.c test/scope.c test/scope.code-out test/static.c test/strinit.c
diffstat 16 files changed, 257 insertions(+), 94 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Thu Jan 05 13:16:26 2006 +0900
+++ b/.gdbinit	Thu Jan 05 21:29:55 2006 +0900
@@ -46,6 +46,7 @@
 # run -s -DINLINE=inline test/basic.c
 # run -s test/too-long-argument.c
 # run -s test/strinit.c
-# run -s test/linux_kernel.c.--- 
-run -DINLINE=inline test/scope.c
+# run -DINLINE=inline test/scope.c
 # run -DINLINE=inline test/code-gen-all.c
+# run  -DINLINE=inline test/bitfield1.c
+run -s test/linux_kernel.c.--- 
--- a/Changes	Thu Jan 05 13:16:26 2006 +0900
+++ b/Changes	Thu Jan 05 21:29:55 2006 +0900
@@ -7837,7 +7837,6 @@
 mode,stmode の関係が炸裂してるね。mode,stmode,ctmode と
 必要なのか。一つにできないの?
 
-
 あぁ、なるほど。local_table でstaticを出力するんだけど、こ
 のstatic は、inline で共有しないといけないわけね。別々にコ
 ードが生成されても単一のコードを呼ぶのと同じでないといけな
@@ -7855,3 +7854,39 @@
 
 inmode でも lastexp があるので、checkret は必要じゃん。
 
+Thu Jan  5 14:10:10 JST 2006
+
+ようやっと scope は通りました。
+
+doif, p_if, st_if と三段階に同じ処理をするのか。それがずれると、
+特に、pxxx で IVAR の置換が残ってしまうらしい。
+
+local variable のKONST attribute に式が入る場合があり、
+それが pexpr されてないらしい。でも、ここに式が入ると、
+毎回計算されるので、結局、うれしくない。なので、
+本当の定数の場合だけセットする方が良い。
+
+微妙に embug してるな。
+
+Thu Jan  5 18:14:45 JST 2006
+
+構造体の初期化なんだけど、
+    {1,2,3,4,{5,6},7}
+    {1,2,3,4,(struct hoge){},7}
+    {1,2,3,4,struct_hoge,7}
+    {1,2,3,4,5,6,7}
+を区別できないんだけど。
+
+もしかして、expr(0) してから判断するのかな。
+
+つうか、{} を一旦、リストに格納してからコード生成するのか。
+その方がいいか。
+
+でも、adhoc にtypeid があったら構造体のコピーということに
+しました。
+
+bit field をinline するなら、bit field value を計算するのを
+やらないとだめだね。code_bit_replace とかに interpreter mode
+をつければいいんだよな。
+
+
--- a/mc-code-arm.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/mc-code-arm.c	Thu Jan 05 21:29:55 2006 +0900
@@ -3764,7 +3764,7 @@
     init=0;
     /* static local variables */
     for(n=local_static_list;n;n=n->next) {
-	if (n->sc == GVAR) {
+	if (n->sc == STATIC) {
 	    if (n->dsp != -1) { /* initialized static */
 		if (init==0) {
 		    data_mode(0);
--- a/mc-code-ia32.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/mc-code-ia32.c	Thu Jan 05 21:29:55 2006 +0900
@@ -2224,7 +2224,7 @@
     init=0;
     /* static local variables */
     for(n=local_static_list;n;n = n->next) {
-	if (n->sc == GVAR) {
+	if (n->sc == STATIC) {
 	    if (init==0) {
 		data_mode(0);
 		init=1;
--- a/mc-code-mips.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/mc-code-mips.c	Thu Jan 05 21:29:55 2006 +0900
@@ -3442,7 +3442,7 @@
     init=0;
     /* static local variables */
     for(n=local_static_list;n;n=n->next) {
-	if (n->sc == GVAR) {
+	if (n->sc == STATIC) {
 	    if (n->dsp != -1) { /* initialized static */
 		if (init==0) {
 		    data_mode(0);
--- a/mc-code-powerpc.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/mc-code-powerpc.c	Thu Jan 05 21:29:55 2006 +0900
@@ -3248,7 +3248,7 @@
     init=0;
     /* static local variables */
     for(n = local_static_list;n!=&null_nptr;n = n->next) {
-	if (n->sc == GVAR) {
+	if (n->sc == STATIC) {
 	    if (init==0) {
 		data_mode(0);
 		init=1;
--- a/mc-codegen.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/mc-codegen.c	Thu Jan 05 21:29:55 2006 +0900
@@ -769,8 +769,9 @@
 	case ADDRESS:
 	    e = cadr(e);
 	    return (car(e)==GVAR||car(e)==FNAME||car(e)==LVAR);
-	case STRING: case GVAR: case FUNCTION: case EXTRN: case EXTRN1:
-	case CODE: case FNAME:
+	case STRING: case GVAR: 
+	// case FUNCTION: case CODE: 
+	case EXTRN: case EXTRN1: case FNAME:
 	case CONST: case LCONST: case FCONST: case DCONST:
 	return 1;
     default:
@@ -1410,6 +1411,7 @@
 #endif
 	} else {
 	    /* check used sources in rather complex source */
+	    /*   more complex sources are compiled before */
 	    caddddr(e2)=contains_p1(0,s0,check_source);
 	}
     }
@@ -2581,6 +2583,8 @@
 	} else if (NULLARY_ARGS(car(e))) {
         /* nullary operators */
 	    return 0;
+	} else if (IS_STATEMENT(car(e))) {
+	    return 1;  // may contain anything
 	} else {
 	    // fprintf(stderr,"Unknown Tree ID %d\n",car(e));
 	    error(-1);
@@ -2627,6 +2631,8 @@
 	} else if (NULLARY_ARGS(car(e))) {
         /* nullary operators */
 	    return 0;
+	} else if (IS_STATEMENT(car(e))) {
+	    return 1;  // may contain anything
 	} else {
 	    // fprintf(stderr,"Unknown Tree ID %d\n",car(e));
 	    error(-1);
@@ -2636,6 +2642,8 @@
     return 0;
 }
 
+/* gahter accumurated list in all parse tree */
+
 static int
 contains_in_list_p1(int arg,int e,int (*p)(int,int))
 {
@@ -2673,6 +2681,8 @@
         /* nullary operators */
 	    arg=p(arg,e);
 	    return arg;
+	} else if (IS_STATEMENT(car(e))) {
+	    return arg;
 	} else {
 	    // fprintf(stderr,"Unknown Tree ID %d\n",car(e));
 	    // error(-1);
@@ -3134,7 +3144,8 @@
     }
     /* constant value field */
     if (offset==0 && (has_attr(n,KONST))) {
-	set_attr(n,KONST,e);
+	if (is_const(e))
+	    set_attr(n,KONST,e);
     }
     return offset+((t==EMPTY)?cadr(e):size(t));
 }
--- a/mc-inline.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/mc-inline.c	Thu Jan 05 21:29:55 2006 +0900
@@ -434,9 +434,9 @@
 static int
 pindirect(int e)
 {
-    int lvar;
-    if (car(lvar=cadr(e))==IVAR)
-	lvar=p_lvar(cadr(e)); // can be anything....
+    //int lvar;
+    //if (car(lvar=cadr(e))==IVAR)
+    //	lvar=p_lvar(cadr(e)); // can be anything....
     return list3(car(e),pexpr(cadr(e)),caddr(e));
 }
 
@@ -540,13 +540,16 @@
 static int
 pbassign(int e)
 {
-    return list4(car(e),pexpr(cadr(e)),pexpr(caddr(e)),cadddr(e));
+    // list4(BASS,e1,e2,list2(BASS,t)));
+    int e1=pexpr(caddr(e));
+    return list4(car(e),pexpr(cadr(e)),e1,cadddr(e));
 }
 
 static int
 pbassop(int e)
 {
-    return list4(car(e),pexpr(cadr(e)),pexpr(caddr(e)),cadddr(e));
+    int e1=pexpr(caddr(e));
+    return list4(car(e),pexpr(cadr(e)),e1,cadddr(e));
 }
 
 static int
@@ -995,6 +998,8 @@
 #if BIT_FIELD_CODE
     case RBIT_FIELD:
 	return prbit_field(e1);
+    case BIT_FIELD:
+        return list3(BIT_FIELD,pexpr(e2),caddr(e1));
     case BASS:
 	return pbassign(e1);
     case BPREINC:
--- a/mc-macro.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/mc-macro.c	Thu Jan 05 21:29:55 2006 +0900
@@ -19,7 +19,7 @@
 static int macro_function(int macrop,char **pchptr,NMTBL *nptr,int history);
 static void local_define(char *macro,char *value);
 static int macro_eval(int macrop,char *body0,int history);
-extern char * mappend(int lists,char **result);
+static char * mappend0(int lists,char **result);
 static int macro_processing();
 
 static void
@@ -54,7 +54,7 @@
     cheap = reset_cheap(&scheap);
     macropp = cheap->ptr;
     // we can reset cheap, no page wrap in this case
-    mappend(reverse0(macrop),&macropp);
+    mappend0(reverse0(macrop),&macropp);
     cheap->ptr[-1] ='\n';
     cheap->ptr[0] =0;
     cheap = increment_cheap(cheap,&macropp);
@@ -79,7 +79,7 @@
 	cheap = reset_cheap(&scheap);
 	macropp = cheap->ptr;
 	// will not override evaled list
-        mappend(reverse0(macrop),&macropp);
+        mappend0(reverse0(macrop),&macropp);
 	cheap->ptr[-1] ='\n';
 	cheap->ptr[0] =0;
 	cheap = increment_cheap(cheap,&macropp);
@@ -717,7 +717,7 @@
     evalues = reverse0(evalues);
     enter_scope();
     while(args) {
-	mappend(reverse0(car(evalues)),&macro);
+	mappend0(reverse0(car(evalues)),&macro);
 	local_define((char *)car(args),macro);
 	args = cadr(args);
 	evalues = cadr(evalues);
@@ -838,8 +838,8 @@
     result overwrited by next cheap allocation
  */
 
-extern char *
-mappend(int lists,char **result)
+static char *
+mappend0(int lists,char **result)
 {
     char *p;
     *result = cheap->ptr;
@@ -854,4 +854,21 @@
     return *result;
 }
 
+// do not replace \n
+extern char *
+mappend(int lists,char **result)
+{
+    char *p;
+    *result = cheap->ptr;
+    for(;lists;lists = cadr(lists)) {
+        p = (char *)car(lists);
+        for(;(*cheap->ptr=*p++);cheap = increment_cheap(cheap,0)) {
+	    // in_quote + \n case ? should be \n.
+	    // if (p[-1]=='\n') cheap->ptr[0]=' ';
+	}
+    }
+    cheap = increment_cheap(cheap,0);
+    return *result;
+}
+
 /* end */
--- a/mc-parse.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/mc-parse.c	Thu Jan 05 21:29:55 2006 +0900
@@ -404,6 +404,7 @@
 	p=(s==RPAR) ? "')'": (s==RBRA) ? "']'": (s==SM) ? "';'":
 	  (s==LPAR) ? "'('": (s==WHILE) ? "'while'":
 	  (s==ASS) ? "'='": 
+	  (s==RC) ? "'}'": (s==LC) ? "'{'": 
 	  (s==COMMA) ? "','": 
 	  (s==COLON) ? "':'": "Identifier";
 	fprintf(stderr,"%d:%s expected.\n",lineno,p);
@@ -1343,6 +1344,24 @@
 #define LOCAL_STRUCT_INIT_STATIC 1
 
 static int
+decl_data_1(int type,NMTBL *n,int offset)
+{
+    int t;
+    getsym(0);
+    if (sym==LPAR) {
+	offset = decl_data_1(type,n,offset);
+	checksym(RPAR);
+    } else if (typeid(sym)) {
+	t = typename();
+	checksym(RPAR);
+	offset = decl_data(t,n,offset,1);
+    } else {
+	return 0;
+    }
+    return offset;
+}
+
+static int
 decl_data_field(int type,NMTBL *n,int offset)
 {
     int t1,t2,period=0;
@@ -1357,11 +1376,15 @@
     }
     t1 = caddr(type0);  /* list of fields */
     if (sym==LC) getsym(0);
-    else {
+    else if (sym==LPAR) {
 	// have to be a value, no comma cascading values
         //    .__tcp_lhash_lock = (rwlock_t) { },
-	offset = decl_data(type,n,offset,0);
-	return offset;
+        // We cannot this distinguish this case and cascading comma here.
+        // Do it more upper syntactical node;
+	if ((offset =  decl_data_1(type,n,offset))) {
+	    return offset;
+	}
+	checksym(RPAR);
     }
     mode=SFDINIT;
     while(1) {
@@ -1378,7 +1401,10 @@
 	    } else
 		error(INERR);
 	} else {
-	    if(period) error(INERR);
+            if(period) {
+		if (sym==RC) break;  /*  {.hoge=v,} case */
+		error(INERR);
+	    }
 	    if(!t1) break; // empty field case (it can happen...)
 	    // next decl_data must skip getsym
 	    offset = decl_data(car(t1),n,offset,1);  /* alignment? */
@@ -1516,9 +1542,13 @@
 	    if (caddr(t0)==0) {                  /* size not defined      */
 		caddr(t0)=size(type);           /* define array size     */
 	    } else if (caddr(t0)!=size(type)) {  /* size match?           */
+		if (caddr(t0)>size(type)) {
+		    // shorter string needs filler
+		    return offset;
+		}
 		error(TYERR);
 	    }
-	    return offset; /* not reached */
+	    return offset; 
 	}
     } else if (t1==BIT_FIELD) {
  	e=expr1();
@@ -1553,12 +1583,13 @@
     declaration in struct/union
  */
 static void
-sdecl_field()
+sdecl_field(int smode)
 {
     while (getsym(0) != RC) {
         decl();
     }
     if (sdecl_f) conv->rc_();
+    mode = smode;
     getsym(0);
     fields =  reverse0(fields);
 }
@@ -1584,7 +1615,7 @@
 static int
 sdecl(int s)
 {
-    int smode,sdisp,sbit_field_disp,type0=0;
+    int smode,sdisp,mymode,sbit_field_disp,type0=0;
     NMTBL *nptr0,*gnptr0;
     int sfields = fields;
 
@@ -1594,6 +1625,7 @@
 	mode=(s==STRUCT?GSDECL:GUDECL);
     else
 	mode=(s==STRUCT?LSDECL:LUDECL);
+    mymode = mode;
     sdisp=disp;
     sbit_field_disp=bit_field_disp;
     disp=0;
@@ -1604,19 +1636,22 @@
 	nptr0 = nptr;
 	gnptr0 = gnptr;
 	if (sdecl_f) conv->id_(sym,nptr);
+	mode = smode;  // return to (possibly) LDECL for next getsym
 	if (getsym(0) == LC) {
 	    /* struct define case */
+	    mode=mymode;
 	    if (sdecl_f) conv->lc_();
 	    if (nptr0->sc == EMPTY) nptr0=gnptr0;
 	    if (nptr0->sc!=TAG && nptr0->sc != EMPTY) error(DCERR);
 	    nptr0->sc = TAG;
 	    nptr0->ty = list4(s,-1,0,(int)nptr0);
-	    sdecl_field();
+	    sdecl_field(smode);
 	    caddr(nptr0->ty)=fields;
 	    cadr((type0 = nptr0->ty))=disp;
 	    /* type0 = list4(s,disp,fields,0); now ... */
 	} else {
 	    /* struct reference case */
+	    mode=mymode;
 	    if(nptr0->sc == EMPTY) nptr0=gnptr0;
 	    if(nptr0->sc == EMPTY) nptr0->sc = TAG;
 	    if(nptr0->sc != TAG) error(TYERR);
@@ -1630,7 +1665,7 @@
     } else if(sym==LC) {
 	/* no tag name */
 	if (sdecl_f) conv->lc_();
-	sdecl_field();
+	sdecl_field(smode);
 	type0 = list4(s,disp,fields,0);
     }
     else error(DCERR);
@@ -3325,7 +3360,7 @@
 	case FLABEL: case BLABEL:
 	    return fname(nptr);
 	case FUNCTION: case CODE:
-	    error(-1);
+	    error(-1);          // FNAME have to be used
 	    break;
 	case LVAR:
 	case IVAR:
@@ -3356,9 +3391,9 @@
 		break;
 	    } else {
 		nptr->sc = EXTRN1;
-		nptr->ty= glist3(FUNCTION,INT,0);
+                type = nptr->ty= glist3(FUNCTION,INT,0);
 		e1=list2(FNAME,(int)nptr);
-		type=list3(nptr->sc,nptr->ty,nptr->dsp);
+		// type=list3(nptr->sc,nptr->ty,nptr->dsp);
 		break;
 	    }
 	default:error(UDERR);
@@ -3955,6 +3990,7 @@
 	for(i=0;name[i];i++);
 	nptr = name_space_search(hash_search(name,&scheap,i,hash,DEF),STRING);
     }
+    nptr->dsp = i;
     symval = i;
 }
 
@@ -4150,7 +4186,7 @@
 
 	switch(mode) {
 	case ADECL: if (nptr0->sc ==TYPE) return sym; break;
-	case GDECL: case GSDECL: case GUDECL: 
+	case GDECL: case GSDECL: case GUDECL: case LSDECL: case LUDECL: 
 	case GTDECL: case TOP: case GEDECL: case SFDINIT:
 	    return sym;
 	}
@@ -4160,7 +4196,7 @@
 	    /* can be undeclared global variable */
 	    return sym;
 	}
-	/* define case */
+	/* define case LDECL ony? */
 	nptr = make_local_scope(nlist,nptr,sc);
 	return sym;
 
--- a/test/bitfield1.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/test/bitfield1.c	Thu Jan 05 21:29:55 2006 +0900
@@ -1,5 +1,9 @@
 int printf(const char *format, ...);
 
+#ifndef INLINE
+#define INLINE
+#endif
+
    struct aho {
         int i:1,j:1;
         char a:7;
@@ -73,8 +77,8 @@
     } b;
 } ii;
 void main5();
-int
-main()
+INLINE int
+main1()
 {
     int i;
     printf("#0079:%d\n",a.i);
@@ -178,7 +182,7 @@
     main5();
     return 0;
 }
-
+INLINE
 void
 main5()
 {
@@ -210,3 +214,9 @@
     }
 }
 
+int
+main()
+{
+    main1();
+    return 0;
+}
--- a/test/inline.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/test/inline.c	Thu Jan 05 21:29:55 2006 +0900
@@ -33,16 +33,16 @@
 {
     volatile const int j = 3;
     switch(i) {
-    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;
+    case 1: printf("#0035:1\n"); break;
+    case 2: printf("#0036:2\n"); break;
+    case 3: printf("#0037:3\n"); break;
+    case 4: printf("#0038:4\n"); break;
     }
     switch(j) {
-    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;
+    case 1: printf("#0041:1\n"); break;
+    case 2: printf("#0042:2\n"); break;
+    case 3: printf("#0043:3\n"); break;
+    case 4: printf("#0044:4\n"); break;
     }
     return 0;
 }
@@ -64,7 +64,7 @@
 static
 inline int ins(int i,int j)
 {
-   printf("#0047:%d %d\n",i,j);
+   printf("#0066:%d %d\n",i,j);
    if (f(i)>j) return j;
    else return i;
 }
@@ -72,7 +72,7 @@
 static
 inline int ins1(int i,int j, int k)
 {
-   printf("#0055:%d %d %d\n",i,j,k);
+   printf("#0074:%d %d %d\n",i,j,k);
    if (f(i)>j) return j;
    else return i;
 }
@@ -86,14 +86,14 @@
 	k += 3;
 	order <<= 4; order|=7;
     } while ( k < j);
-    printf("#0066: %d do %d %x\n",p,k,order);
+    printf("#0088: %d do %d %x\n",p,k,order);
 
     while (k > j) {
 	order <<= 4; order|=0;
 	k -= 3;
 	order <<= 4; order|=7;
     } 
-    printf("#0071: %d while %d %x\n",p,k,order);
+    printf("#0095: %d while %d %x\n",p,k,order);
 
     m = 0;
     for(k=0;k<j;k++) {
@@ -109,9 +109,9 @@
 	    m += k;
 	    order <<= 4; order|=10;
 	}
-	printf("#0077: %x\n",order);
+	printf("#0111: %x\n",order);
     }
-    printf("#0077: %d for %d\n",p,m);
+    printf("#0113: %d for %d\n",p,m);
 
 
     switch(i) {
@@ -125,13 +125,13 @@
 	break;
     default: k = 5;
     }
-    printf("#0090: %d switch %d\n",p,k);
+    printf("#0127: %d switch %d\n",p,k);
 
     for(k=0;k<j;k++) {
 	i += k;
 	if (k<3) continue;
     }
-    printf("#0096: %d for %d\n",p,i);
+    printf("#0133: %d for %d\n",p,i);
     goto hoge;
 hage:
     goto hage;
@@ -152,27 +152,27 @@
     // a = 10;
 
     k1 = in1(a,b);
-    printf("#0117:%d %d %d\n",a,b,k1);
+    printf("#0154:%d %d %d\n",a,b,k1);
     j1 = in1(k,j-6)+f(k1);
-    printf("#0119:%d %d %s\n",k1,j1,hoo);
+    printf("#0156:%d %d %s\n",k1,j1,hoo);
     k1 = &v-&x>0? &v-&x : &x-&v;
-    printf("#0121:v-x: %d\n",k1);
+    printf("#0158:v-x: %d\n",k1);
 
     k1 = ins(a,b);
     j1 = ins(k,j-6)+f(k1);
-    printf("#0125:%d %d %s\n",k1,j1,haa);
+    printf("#0162:%d %d %s\n",k1,j1,haa);
 
     k1 = ins(as,bs);
     j1 = ins(k,j-6)+f(k1);
-    printf("#0129:%d %d %s\n",k1,j1,haa);
+    printf("#0166:%d %d %s\n",k1,j1,haa);
 
     k1 = ins(v,x);
     j1 = ins(k,j-6)+f(v);
-    printf("#0133:%d %d %s\n",k1,j1,haa);
+    printf("#0170:%d %d %s\n",k1,j1,haa);
 
     k1 = fnp(v,x,5);
     j1 = ins1(k,j-6,6)+f(v);
-    printf("#0137:%d %d %s\n",k1,j1,haa);
+    printf("#0174:%d %d %s\n",k1,j1,haa);
 }
 
 void
@@ -191,13 +191,13 @@
 static
 inline int order(int a0,int a1,int a2, int a3, int a4)
 {
-    printf("#0156:order  %d %d %d %d %d\n",a0,a1,a2,a3,a4);
+    printf("#0193: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("#0162:orderp %d %d %d %d %d\n",a0,a1,a2,a3,a4);
+    printf("#0199: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;
@@ -220,7 +220,7 @@
 main(int ac,char *av[])
 {
      fnp = ins1;
-     printf("%d\n",(1,2,3,4,5));
+     printf("#0222:%d\n",(1,2,3,4,5));
      order(1,2,3,4,5);
      order1p(1,2,3,4,5);
      a0(5,6);
--- a/test/scope.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/test/scope.c	Thu Jan 05 21:29:55 2006 +0900
@@ -26,6 +26,20 @@
 } 
 
 INLINE
+int
+g(int m,int n)
+{
+    int k=m,i=n-3;
+    if (m==2) return 0;
+    if (k==2||k==3||k==i) {
+	if (k==2||k==3||k==4) {
+	    printf("#0035:k,i=%d,%d\n",k,i);
+	}
+    }
+    return m+n;
+}
+
+INLINE
 static int
 main0()
 {
@@ -33,7 +47,7 @@
     void *exit = &&exit0;
     i = 3;k=10;
 
-        printf("#0035:%s,%s,%d\n",
+        printf("#0049:%s,%s,%d\n",
 	    __FILE__,
 	    __FUNCTION__,
 	    __LINE__
@@ -43,13 +57,19 @@
     for(int k=0;k<10;k++) { 
 	int i;
 	i = 4;
+	if (k==2||k==3||k==i) {
+	    if (k==2||k==3||k==4) {
+		const int m=g(k,i);
+		printf("#0062:m=%d\n",m);
+	    }
+	}
 	if (({
 	    __label__ exit0; 
 	    int i; 
 		f(&i,&&exit0); 
 		if (i==5) 
 		    goto exit0;
-		printf("#0051:2nd inner %d %d %0x\n",i,k,&&exit1==exit);
+		printf("#0071:2nd inner %d %d %0x\n",i,k,&&exit1==exit);
 	    exit0:
 	    i;
 	    })!=7) {
@@ -59,11 +79,11 @@
 	/* not reached */
 	i = ({ int k=3; k; });
 exit1:
-	printf("#0061:inner %d %d %0x\n",i,k,&&exit1==exit);
+	printf("#0081:inner %d %d %0x\n",i,k,&&exit1==exit);
     }
     k++;
 exit0:
-    printf("#0065:outer %d %d %0x\n",i,k,&&exit0==exit);
+    printf("#0085:outer %d %d %0x\n",i,k,&&exit0==exit);
     return 0;
 }
 
--- a/test/scope.code-out	Thu Jan 05 13:16:26 2006 +0900
+++ b/test/scope.code-out	Thu Jan 05 21:29:55 2006 +0900
@@ -1,15 +1,19 @@
-#0035:test/scope.c,main0,39
+#0049:test/scope.c,main0,53
 #0024:f 2
-#0051:2nd inner 3 0 0
-#0061:inner 4 0 0
+#0071:2nd inner 3 0 0
+#0081:inner 4 0 0
 #0024:f 1
-#0051:2nd inner 4 1 0
-#0061:inner 4 1 0
+#0071:2nd inner 4 1 0
+#0081:inner 4 1 0
+#0062:m=0
 #0024:f 0
-#0061:inner 4 2 0
+#0081:inner 4 2 0
+#0035:k,i=3,1
+#0062:m=7
 #0024:f -1
-#0051:2nd inner 6 3 0
-#0061:inner 4 3 0
+#0071:2nd inner 6 3 0
+#0081:inner 4 3 0
+#0062:m=8
 #0024:f -2
-#0051:2nd inner 7 4 0
-#0065:outer 3 10 1
+#0071:2nd inner 7 4 0
+#0085:outer 3 10 1
--- a/test/static.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/test/static.c	Thu Jan 05 21:29:55 2006 +0900
@@ -1,15 +1,19 @@
 int printf(const char *format, ...);
 
+#ifndef INLINE
+#define INLINE
+#endif
 
+INLINE void
 f()
 {
    static int count = 55;
    static int count1;
 
-   printf("#0008:%d %d\n",count++,count1++);
+   printf("#0012:%d %d\n",count++,count1++);
   
 }
-
+int
 main()
 {
    f();
--- a/test/strinit.c	Thu Jan 05 13:16:26 2006 +0900
+++ b/test/strinit.c	Thu Jan 05 21:29:55 2006 +0900
@@ -31,6 +31,13 @@
 struct temp temp4 = { 1,2,3,4,5,6,7};
 struct temp temp7 = { 1,2,3,4,{5,6},7};
 
+#if 0
+struct temp temp10 = {
+   .m = (struct hoge){},    // not allowed in global
+   .c = (int)&b,
+};
+#endif 
+
 void
 linux_kernel();
 
@@ -46,17 +53,30 @@
     struct temp temp6 = { 1,2,3,4,5,6,7};
     struct temp temp8 = { 1,2,3,4,{5,6},7};
 #endif
-    printf("#0048:1: %d\n",temp1.a);
-    printf("#0049:1: %d\n",temp1.e);
-    printf("#0050:1: %d\n",temp1.b);
-    printf("#0051:2: %d\n",temp2.c);
-    printf("#0052:2: %d\n",temp2.e);
-    printf("#0053:2: %d\n",temp2.b);
-    printf("#0054:2: %d\n",(void*)temp3.c==b);
-    printf("#0055:2: %d\n",temp3.c==(int)b);
-    printf("#0056:2: %d\n",temp3.a==(int)&b);
-    printf("#0057:2: %d\n",temp4.m.j);
-    printf("#0058:2: %d\n",temp5.m.j);
+    struct temp temp11 = {
+       .m = (struct hoge){},
+       .c = (int)&b,
+    };
+    struct temp temp12 = {
+       .m = (struct hoge){1,3},
+       .c = (int)&temp4,
+    };
+
+    printf("#0064:1: %d\n",temp1.a);
+    printf("#0065:1: %d\n",temp1.e);
+    printf("#0066:1: %d\n",temp1.b);
+    printf("#0067:2: %d\n",temp2.c);
+    printf("#0068:2: %d\n",temp2.e);
+    printf("#0069:2: %d\n",temp2.b);
+    printf("#0070:2: %d\n",(void*)temp3.c==b);
+    printf("#0071:2: %d\n",temp3.c==(int)b);
+    printf("#0072:2: %d\n",temp3.a==(int)&b);
+    printf("#0073:2: %d\n",temp4.m.j);
+    printf("#0074:2: %d\n",temp5.m.j);
+    printf("#0075:2: %d\n",temp11.m.j);
+    printf("#0076:2: %d\n",temp12.m.k);
+    printf("#0077:2: %d\n",temp12.m.j);
+    printf("#0078:2: %d\n",temp11.c==(int)&b);
     linux_kernel();
     return 0;
 }
@@ -136,7 +156,7 @@
                                        { .sport = sport,
                                          .dport = dport } } };
 
-	printf("#0138:%d %d\n",fl.oif,fl.uli_u.ports.dport);
+	printf("#0158:%d %d\n",fl.oif,fl.uli_u.ports.dport);
 }
 
 static 
@@ -154,8 +174,8 @@
                                        { .sport = sport,
                                          .dport = dport } } };
 
-	printf("#0156:%d %d\n",fl.oif,fl.uli_u.ports.dport);
-	printf("#0157:%d %d\n",fl.iif,fl.nl_u.ip4_u.saddr);
+	printf("#0176:%d %d\n",fl.oif,fl.uli_u.ports.dport);
+	printf("#0177:%d %d\n",fl.iif,fl.nl_u.ip4_u.saddr);
 }
 
 void