diff mc-codegen.c @ 332:ce85d6106119

bit field continue. (code generation done)
author kono
date Thu, 24 Jun 2004 15:21:43 +0900
parents f25aa4f03198
children bd3e6eff7d41
line wrap: on
line diff
--- a/mc-codegen.c	Wed Jun 23 22:37:32 2004 +0900
+++ b/mc-codegen.c	Thu Jun 24 15:21:43 2004 +0900
@@ -2240,12 +2240,12 @@
     }
     if (mode==GSDECL||mode==LSDECL|| mode==GUDECL||mode==LUDECL) {
           /* Struct fields name lists are in the struct type or tag. */
-          /* Only name in the table is used. */
-	if (car(n->ty)==BIT_FIELD) {
+          /* Only name in the table is used. Do not set n->ty! */
+	if (car(type)==BIT_FIELD) {
 	    bit_field_disp=sbit_f;   // default is 0, recover only here.
             // n->ty = list4(BIT_FIELD,type,bit_offset,bit_width);
-	    caddr(n->ty) = code_bit_field_disp(
-		n->ty,&disp,&bit_field_disp,&sz);
+	    caddr(type) = code_bit_field_disp(
+		type,&disp,&bit_field_disp,&sz);
 	    /* bit_field_disp is next bit posision */
 	}  else {
 	    sz = size(type);
@@ -3173,6 +3173,10 @@
 static int
 bit_field(int e1,int t)
 {
+if (car(e1)==BIT_FIELD) {
+    printf("# bit_field_bug\n");
+    e1 = cadr(e1);
+}
     g_expr(e1);
     code_bit_field(t, caddr(t)  /* bit offset */, USE_CREG);
     return cadr(t);